Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.
You might want to look at the current version, PrestaShop 8. Read the updated version of the documentation
Unit tests are great if you want to validate the behavior of a single unit of code. By “unit of code” we usually mean a class although it could also be a script.
Everything is explained in the PHPUnit 5.7 documentation.
For unit tests, we strongly encourage you to base your test on the PHPUnit’s TestCase
class only.
For instance:
<?php
namespace Tests\Unit\Foo;
use PHPUnit\Framework\TestCase;
class BarTest extends TestCase
{
/* ... */
}
Unit tests should be located into tests/Unit
folder and follow the same path as the tested class: if a class is located into src/Core/Foo/Baz
, the unit test should be into tests/Unit/Core/Foo/Baz
folder.