implemented support for PHPUnit's @depends

This commit is contained in:
Adrian Nürnberger
2020-06-19 19:50:54 +02:00
parent 283d8f3e03
commit d0a74931dd
7 changed files with 120 additions and 12 deletions

View File

@ -42,6 +42,15 @@
✓ eager registered wrapped datasets did the job right
✓ lazy named datasets with (Bar Object (...))
PASS Tests\Features\Depends
✓ first
✓ second
✓ dependsOn
✓ dependsOn with ...params
✓ dependsOn with defined arguments
✓ dependsOn run test only once
✓ depends alias for dependsOn
PASS Tests\Features\Exceptions
✓ it gives access the the underlying expectException
✓ it catch exceptions
@ -144,5 +153,5 @@
WARN Tests\Visual\Success
s visual snapshot of test suite on success
Tests: 6 skipped, 79 passed
Time: 3.44s
Tests: 6 skipped, 86 passed
Time: 2.61s

View File

@ -0,0 +1,47 @@
<?php
$runCounter = 0;
test('first', function () use (&$runCounter) {
assertTrue(true);
$runCounter++;
return 'first';
});
test('second', function () use (&$runCounter) {
assertTrue(true);
$runCounter++;
return 'second';
});
test('dependsOn', function () {
assertEquals(
['first', 'second'],
func_get_args()
);
})->dependsOn('first', 'second');
test('dependsOn with ...params', function (string ...$params) {
assertEquals(
['first', 'second'],
$params
);
})->dependsOn('first', 'second');
test('dependsOn with defined arguments', function (string $first, string $second) {
assertEquals('first', $first);
assertEquals('second', $second);
})->dependsOn('first', 'second');
test('dependsOn run test only once', function () use (&$runCounter) {
assertEquals(2, $runCounter);
})->dependsOn('first', 'second');
test('depends alias for dependsOn', function (string ...$params) {
assertEquals(
['first', 'second'],
$params
);
})->depends('first', 'second');