Add a unit test for a controller class, OmisePaymentModuleFrontController.
Emphasize the dependencies of a controller class, OmisePaymentModuleFrontController. The dependencies should be reduced.
Related information:
Related issue: -
Related ticket: -
Required pull request: #14
2. Description of change
Add a dependency, Mockery, for the unit testing. This dependency has been used to create mock object for the static methods.
Using the Composer to be the dependency management.
Add a unit test for a class, OmisePaymentModuleFrontController.
Un-track a directory, vendor, from Git by add a new entry to the list of gitignore. This directory has been used to store the local dependency which it does not need to store in the repository.
3. Quality assurance
Environments:
Platform version: - (This pull request did not change the base source code. Therefore, it is not required to test with platform.)
Omise plugin version: Omise-PrestaShop 1.6.0.0
PHP versions: 5.4, 5.5, 5.6, 7.0 and 7.1
Details:
Manual testing
Run the unit testing with PHPUnit (no additional required parameters).
For example:
$ phpunit
Automated testing
Setup the system such as Travis CI, CircleCI or Jenkins.
4. Impact of the change
-
5. Priority of change
Normal
6. Additional notes
There are 2 methods have not been tested.
The method getAmount() has not been tested because it has a reference to another class constant, Cart::BOTH. This reference is not easy to mock with PHPUnit or Mockery. Although, to test this method, it can be used another technique by create stub but for this time, create stub has more expensive.
The method initContent() has not been tested too because this method depends on the above method, getAmount().
1. Objective
OmisePaymentModuleFrontController
.OmisePaymentModuleFrontController
. The dependencies should be reduced.Related information: Related issue: - Related ticket: - Required pull request: #14
2. Description of change
OmisePaymentModuleFrontController
.3. Quality assurance
Environments:
Details:
Manual testing Run the unit testing with PHPUnit (no additional required parameters). For example:
Automated testing Setup the system such as Travis CI, CircleCI or Jenkins.
4. Impact of the change
-
5. Priority of change
Normal
6. Additional notes
getAmount()
has not been tested because it has a reference to another class constant,Cart::BOTH
. This reference is not easy to mock with PHPUnit or Mockery. Although, to test this method, it can be used another technique by create stub but for this time, create stub has more expensive.initContent()
has not been tested too because this method depends on the above method,getAmount()
.The screenshot below shows the passed unit tests at Travis CI.
The screenshot below shows the passed unit tests at CircleCI.