Unit Testing

The eCommerce module is integrated with unit test scripts which help test the functionality of individual units of code within the module, such as classes, functions, and methods. The unit tests in the eCommerce module cover these areas:

  • Replication (probably three to four different types of product with their meta data).
  • Customer log in, log out, registration, contact update.
  • Add to cart with simple and configurable product with and without discounts.
  • Posting order as offline and online payment methods.
  • Click and Collect as online and pay at the store payment methods.
  • Gift card and Loyalty points.
  • Coupon code redemption.

Update the phpunit.xml file under dev > tests > unit > phpunit.xml with code below

Copy
<testsuite name="Ls_Modules">
    <directory suffix="Test.php">../../../vendor/lsretail/lsmag-two/src/*/Test/Unit</directory>
</testsuite>
<php>
    <ini name="date.timezone" value="America/Los_Angeles"/>
    <ini name="xdebug.max_nesting_level" value="200"/>
    <env name="BASE_URL" value="http://0.0.0.0/LSOmniService" force="true" />
    <env name="STORE_ID" value="S0013" force="true" />
    <env name="CARD_ID" value="10037" force="true" />
    <env name="CONTACT_ID" value="MA000009" force="true" />
    <env name="USERNAME" value="sud" force="true" />
    <env name="EMAIL" value="support.customer@lsretail.com" force="true" />
    <env name="PASSWORD" value="sud@0011" force="true" />
    <env name="GIFTCARDCODE" value="G000001" force="true" />
    <env name="STOREID" value="S0010" force="true" />
</php>

Once the update is done, run this command from Magento project root to execute a unit test through CLI:

Copy
php -f vendor/bin/phpunit -- -c dev/tests/unit/phpunit.xml