Download the PHP package drupsys/codeception-use-cases-module without Composer

On this page you can find all versions of the php package drupsys/codeception-use-cases-module. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package codeception-use-cases-module

CODECEPTION USE CASES MODULE

A codeception module for use case based tests, this module aims to promote writing of real unit tests as described in the "TDD, Where Did It All Go Wrong" talk by Ian Cooper.

Relevant references:

Setup

Assuming you have tests/usecase.suite.yaml file, enable this module like this

Specifically note \MVF\Codeception\UseCases\Module added to the list of modules. This module has required config to function properly, the list of providers must be defined.

MySql Provider

This is an object that must implement MVF\Codeception\UseCases\Contracts\MySqlInterface and it should look something like this.

Redis Provider

This is an object that must implement MVF\Codeception\UseCases\Contracts\RedisInterface and it should look something like this.

Services

Your docker compose file should have the following services

\<app>-test-mysql

MySql service should have MYSQL_ROOT_PASSWORD set to 12345, have command with the following flags --server-id=1 --log-bin=test.log, if you already define some command just append these flags to your existing command, and should use [mvf_shared] network.

\<app>-binlog-parser

Maxwell service should use [mvf_shared] network as well and it should be built in build/binlog-parser folder. this folder should have Dockerfile and config.properties files.

The content of your Dockerfile is below, check maxwell and alpine versions to see if there is a newer version available.

The content of your config.properties is below.

Most of this config should be self-explanatory the only thing to elaborate is redis_key this is where maxwell will store all the bin log data, by default this key is set to maxwell but if you are already using this key in your application then you need to change the value of it.

If you change your redis_key value to testing then you must also provide additional config in your test suite. Assuming you have tests/usecase.suite.yaml then new redis_key must also be defined there like this.

\<app>-redis

Redis service should use [mvf_shared] network like the other services.

Requirements and Motivation

For this module to work you will need:

There is quite a lot going on in this module, I assume you will have a lot of questions, lets start answering some of them.

Why do we need mysql test server with bin logs enabled?

Short answer is, it is needed for maxwell daemon to know what mutations have been performs on the database.

What is Maxwell daemon?

This is a process that consumes mysql binlogs converts them to simple json objects and sends them to one of the supported targets, in our case a Redis server.

Why does this module need Redis to function?

Again, short answer is, maxwell daemon uses redis as the store for binlogs. There are a number of different services where maxwell daemon can store binlogs but redis is the most suitable because we need to read the stored data in php code, and it is very easy to read data from Redis.

What is the point of it all?

The added complexity solves an issue we had with database resets. The database that we are working with takes about 40 seconds to reset after each test. Maxwell daemon allows us to know what tables were effected anc with that we can truncate only those tables that must be truncated. This improved the speed of each test around 120 times.

This also provides us a way to write purely declarative tests, at no point in you test you have to interact with a database or write logic. The process of writing tests can be summarised with these steps:

initial state is just an associative array that describes everything about the state of your application before code execution and final state is an associative array that describes everything about your application after code execution.


All versions of codeception-use-cases-module with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
ext-redis Version *
lstrojny/functional-php Version ^1.17
guzzlehttp/guzzle Version ^7.4
drupsys/servicer-contracts Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package drupsys/codeception-use-cases-module contains the following files

Loading the files please wait ....