To provide a place for unit tests, move approval tests and change config

This commit is contained in:
Sam Burns 2024-01-24 14:44:10 +00:00
parent bad5ca93fd
commit 46f45e2661
7 changed files with 27 additions and 5 deletions

View File

@ -21,12 +21,13 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Tests\\": "tests/", "Tests\\": "tests/approval/",
"PhpUnitTests\\": "tests/phpunit/",
"BehatTests\\": "tests/behat/contexts/" "BehatTests\\": "tests/behat/contexts/"
} }
}, },
"scripts": { "scripts": {
"tests": "./vendor/bin/phpunit; ./vendor/bin/behat;", "tests": "./vendor/bin/phpunit --testsuite UnitTests; ./vendor/bin/phpunit --testsuite ApprovalTests; ./vendor/bin/behat;",
"test-coverage": "phpunit --coverage-html build/coverage", "test-coverage": "phpunit --coverage-html build/coverage",
"check-cs": "ecs check", "check-cs": "ecs check",
"fix-cs": "ecs check --fix", "fix-cs": "ecs check --fix",

View File

@ -6,8 +6,11 @@
</include> </include>
</coverage> </coverage>
<testsuites> <testsuites>
<testsuite name="AllTests"> <testsuite name="ApprovalTests">
<directory>./tests</directory> <directory>./tests/approval</directory>
</testsuite>
<testsuite name="UnitTests">
<directory>./tests/phpunit</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
</phpunit> </phpunit>

View File

@ -34,7 +34,7 @@ class ApprovalTest extends TestCase
ob_start(); ob_start();
$argv = ['', '30']; $argv = ['', '30'];
include(__DIR__ . '/../fixtures/texttest_fixture.php'); include(__DIR__ . '/../../fixtures/texttest_fixture.php');
$output = ob_get_clean(); $output = ob_get_clean();

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace PhpUnitTests;
use ApprovalTests\Approvals;
use GildedRose\GildedRose;
use GildedRose\Item;
use PHPUnit\Framework\TestCase;
class ExamplelTest extends TestCase
{
public function testFoo(): void
{
$this->assertTrue(true);
}
}