make test directory configurable

This commit is contained in:
Brian Faust
2021-05-03 18:28:20 +03:00
parent d2babb1331
commit 567af55a19
11 changed files with 43 additions and 15 deletions

View File

@ -18,7 +18,7 @@ test('default php unit tests', function () {
$testSuite->addTest($phpUnitTestCase);
expect($testSuite->tests())->toHaveCount(1);
AddsTests::to($testSuite, new \Pest\TestSuite(getcwd()));
AddsTests::to($testSuite, new \Pest\TestSuite(getcwd(), 'tests'));
expect($testSuite->tests())->toHaveCount(1);
});
@ -27,6 +27,6 @@ it('removes warnings', function () {
$warningTestCase = new WarningTestCase('No tests found in class "Pest\TestCase".');
$testSuite->addTest($warningTestCase);
AddsTests::to($testSuite, new \Pest\TestSuite(getcwd()));
AddsTests::to($testSuite, new \Pest\TestSuite(getcwd(), 'tests'));
expect($testSuite->tests())->toHaveCount(0);
});

View File

@ -38,6 +38,7 @@ it('creates an instance and resolves also sub parameters', function () {
it('can resolve builtin value types', function () {
$this->container->add('rootPath', getcwd());
$this->container->add('testPath', 'tests');
$instance = $this->container->get(TestSuite::class);
expect($instance)->toBeInstanceOf(TestSuite::class);

View File

@ -4,7 +4,7 @@ use Pest\Exceptions\TestAlreadyExist;
use Pest\TestSuite;
it('does not allow to add the same test description twice', function () {
$testSuite = new TestSuite(getcwd());
$testSuite = new TestSuite(getcwd(), 'tests');
$test = function () {};
$testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test));
$this->expectException(TestAlreadyExist::class);