Note, original PR was introduced by @nimid at PR #15.
This PR just did rebase #19 into the branch and then reopen it again. (read here, for the reason)
This PR required PR #19 to be merged first.
1. Objective
Support running the unit test with PHP 5.4.
According to the PrestaShop system requirements page, it stated that the supported PHP version is from 5.4 onwards. To ensure that the source code is compatible with those PHP versions, it can be tested at the unit testing level as well.
But when run the unit testing with PHP 5.4, the error is PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/travis/build/nimid/omise-prestashop/tests/unit/OmiseTest.php on line 10.
Related information:
Related issue: -
Related ticket: -
2. Description of change
Changes the syntax that used to create mock object in part of unit testing. The syntax has been changed from the full class name reference to using the internal PHP function, get_class.
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.
1. Objective
Support running the unit test with PHP 5.4.
According to the PrestaShop system requirements page, it stated that the supported PHP version is from 5.4 onwards. To ensure that the source code is compatible with those PHP versions, it can be tested at the unit testing level as well.
But when run the unit testing with PHP 5.4, the error is
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/travis/build/nimid/omise-prestashop/tests/unit/OmiseTest.php on line 10
.The error only occurs with PHP 5.4.
The error related with the
::class
syntax. This syntax has been support since PHP 5.5.Related information: Related issue: - Related ticket: -
2. Description of change
Changes the syntax that used to create mock object in part of unit testing. The syntax has been changed from the full class name reference to using the internal PHP function, get_class.
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
Low
6. Additional notes
The screenshot below shows the error at Travis CI.
The screenshot below shows the error at CircleCI.
The screenshot below shows the supported PHP version on PrestaShop system requirements page.