omise / omise-prestashop

Omise PrestaShop Plugin
https://docs.opn.ooo/prestashop-plugin
MIT License
4 stars 7 forks source link

Initial the unit testing and add a unit test for the main class, Omise #3

Closed nimid closed 8 years ago

nimid commented 8 years ago

1. Objective reason

To deliver quality software, the unit testing is one of many parts that can be achieved. It is easy to initial the unit testing at the beginning of the development.

Required pull request: #1

2. Description of change

Initial the unit testing and add a unit test for the main class, Omise. The unit testing will be run with PHPUnit.

Note:

  1. To run unit test

    $ phpunit

  2. To run unit test with code coverage reporting

    $ phpunit --coverage-html report/

From the second sample command, the report will be generated to the directory report/. It can be changed to another directory.

3. Users affected by the change

None

4. Impact of the change

-

5. Priority of change

Normal

6. Alternate solution

-

guzzilar commented 8 years ago

@nimid got it, anyway, could you consider about both name below,

~/D/O/omise-prestashop (feature/initial-unit-test) $ ./vendor/bin/phpunit tests
PHPUnit 4.4.5 by Sebastian Bergmann.

Configuration read from /omise-prestashop/phpunit.xml

...F.F

Time: 51 ms, Memory: 3.50MB

There were 2 failures:

1) OmiseTest::HookPayment_module_is_activated_and_enabled_display_title
Failed asserting that true matches expected 'x'.

/omise-prestashop/tests/unit/OmiseTest.php:38

2) OmiseTest::HookPayment_module_is_activated_and_enabled_display_the_payment_form
Failed asserting that true matches expected 'x'.

/omise-prestashop/tests/unit/OmiseTest.php:51

FAILURES!
Tests: 6, Assertions: 6, Failures: 2.
~/D/O/omise-prestashop (feature/initial-unit-test) $ 

and

~/D/O/omise-prestashop (feature/initial-unit-test) $ ./vendor/bin/phpunit tests
PHPUnit 4.4.5 by Sebastian Bergmann.

Configuration read from /omise-prestashop/phpunit.xml

...F.F

Time: 50 ms, Memory: 3.50MB

There were 2 failures:

1) OmiseTest::testHookPayment_moduleIsActivatedAndEnabled_displayTitle
Failed asserting that true matches expected 'x'.

/omise-prestashop/tests/unit/OmiseTest.php:36

2) OmiseTest::testHookPayment_moduleIsActivatedAndEnabled_displayThePaymentForm
Failed asserting that true matches expected 'x'.

/omise-prestashop/tests/unit/OmiseTest.php:46

FAILURES!
Tests: 6, Assertions: 6, Failures: 2.

I like the first one because it's kind of I'm reading just sentence. What do you think?

Btw, I'm ok with your naming style, feel free to ignore above. :)

nimid commented 8 years ago

@guzzilar For the test case name that consist of scenario and expectation, using the underscore to be the separator. It is not easy to distinguish.