Testing

Code of the Loki Checkout is tested in various ways:

  • Unit tests based on PHPUnit;
  • Integration tests based on PHPUnit and the Magento Testing Framework;
  • Functional tests based on PHPUnit;
  • Functional tests based on PlayWright;

Unit tests based on PHPUnit

Unit tests are focused on specific methods and classes with little dependencies. Unit tests are meant to be run within an instance of Magento, which for instance gives the benefit of autoloading classes in app/code, but without depending the dev/tests/unit/ folder (which also means that the testing framework its ObjectManager is not used).

Typically, unit tests can be run by using the following CLI:

vendor/bin/phpunit vendor/yireo/magento2-loki-checkout/Test/Unit/

As soon as the complexity of a unit goes up, an integration test is preferred instead.

Integration tests based on PHPUnit

Coming soon

Last modified: January 12, 2025