diff --git a/Makefile b/Makefile index d828e924..6fb5ad66 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,7 @@ docker-php-lint: # target: phpunit (or docker-phpunit) - Run phpunit tests phpunit: tools/vendor - phpunit --configuration=./tests/phpunit.xml; + phpunit tests/unit; docker-phpunit: tools/vendor @$(call in_docker,make,phpunit) diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 2510d363..2fa42214 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -1,8 +1,18 @@ - - + + + + + - - ./unit + + . diff --git a/tests/unit/Decorator/PayloadDecoratorTest.php b/tests/unit/Decorator/PayloadDecoratorTest.php index bc4721a1..e0cf5f72 100644 --- a/tests/unit/Decorator/PayloadDecoratorTest.php +++ b/tests/unit/Decorator/PayloadDecoratorTest.php @@ -2,7 +2,7 @@ use PrestaShop\Module\PsEventbus\Decorator\PayloadDecorator; use PrestaShop\Module\PsEventbus\Formatter\DateFormatter; -use PrestaShop\Module\PsEventbus\Tests\System\Tests\BaseTestCase; +use PHPUnit\Framework\TestCase; use Yandex\Allure\Adapter\Annotation\Features; use Yandex\Allure\Adapter\Annotation\Stories; use Yandex\Allure\Adapter\Annotation\Title; @@ -12,13 +12,8 @@ * * @Stories("payload decorator") */ -class PayloadDecoratorTest extends BaseTestCase +class PayloadDecoratorTest extends TestCase { - public function setUp(): void - { - parent::setUp(); - } - /** * @Stories("payload decorator") * diff --git a/tests/unit/Formatter/ArrayFormatterTest.php b/tests/unit/Formatter/ArrayFormatterTest.php deleted file mode 100755 index 06b63a26..00000000 --- a/tests/unit/Formatter/ArrayFormatterTest.php +++ /dev/null @@ -1,59 +0,0 @@ -arrayFormatter = new ArrayFormatter(); - parent::setUp(); - } - - /** - * @Stories("array formatter") - * - * @Title("testFormatArray") - */ - public function testFormatArray() - { - $data = [ - 'value1', - 'value2', - ]; - - $this->assertEquals('value1;value2', $this->arrayFormatter->arrayToString($data)); - $this->assertEquals('value1:value2', $this->arrayFormatter->arrayToString($data, ':')); - } - - /** - * @Stories("arrayFormatter") - * - * @Title("testFormatValueArrayTest") - */ - public function testFormatValueArrayTest() - { - $data = [ - ['id' => 1, 'value' => 123], - ['id' => 2, 'value' => 456], - ['id' => 3, 'value' => 789], - ]; - - $this->assertEquals('123;456;789', $this->arrayFormatter->formatValueString($data, 'value')); - $this->assertEquals('123:456:789', $this->arrayFormatter->formatValueString($data, 'value', ':')); - } -} diff --git a/tests/unit/Formatter/JsonFormatterTest.php b/tests/unit/Formatter/JsonFormatterTest.php deleted file mode 100755 index c27b52d5..00000000 --- a/tests/unit/Formatter/JsonFormatterTest.php +++ /dev/null @@ -1,42 +0,0 @@ -jsonFormatter = new JsonFormatter(); - } - - /** - * @Stories("json formatter") - * - * @Title("testFormatNewlineJsonString") - */ - public function testFormatNewlineJsonString() - { - $data = [ - ['test' => 'data'], - ['test2' => 'data2'], - ]; - - $this->assertTrue(is_string($this->jsonFormatter->formatNewlineJsonString($data))); - $this->assertMatchesRegularExpression("/\r\n/", $this->jsonFormatter->formatNewlineJsonString($data)); - } -} diff --git a/tests/unit/bootstrap.php b/tests/unit/bootstrap.php new file mode 100644 index 00000000..9795ffa3 --- /dev/null +++ b/tests/unit/bootstrap.php @@ -0,0 +1,6 @@ +