zenstruck /
schedule-bundle
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Zenstruck\ScheduleBundle\Tests\Schedule\Task; |
||
| 4 | |||
| 5 | use PHPUnit\Framework\TestCase; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use Zenstruck\ScheduleBundle\Schedule\Task\Result; |
||
| 7 | use Zenstruck\ScheduleBundle\Tests\Fixture\MockTask; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @author Kevin Bond <[email protected]> |
||
| 11 | */ |
||
| 12 | final class ResultTest extends TestCase |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @test |
||
| 16 | */ |
||
| 17 | public function can_create_skipped() |
||
| 18 | { |
||
| 19 | $task = new MockTask(); |
||
| 20 | $result = Result::skipped($task, 'some reason'); |
||
| 21 | |||
| 22 | $this->assertSame($task, $result->getTask()); |
||
| 23 | $this->assertTrue($result->isSkipped()); |
||
| 24 | $this->assertFalse($result->isSuccessful()); |
||
| 25 | $this->assertFalse($result->isFailure()); |
||
| 26 | $this->assertFalse($result->isException()); |
||
| 27 | $this->assertFalse($result->hasRun()); |
||
| 28 | $this->assertNull($result->getException()); |
||
| 29 | $this->assertNull($result->getOutput()); |
||
| 30 | $this->assertSame('some reason', $result->getDescription()); |
||
| 31 | $this->assertSame('some reason', (string) $result); |
||
| 32 | $this->assertSame(Result::SKIPPED, $result->getType()); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @test |
||
| 37 | */ |
||
| 38 | public function can_create_successful() |
||
| 39 | { |
||
| 40 | $task = new MockTask(); |
||
| 41 | $result = Result::successful($task); |
||
| 42 | |||
| 43 | $this->assertSame($task, $result->getTask()); |
||
| 44 | $this->assertFalse($result->isSkipped()); |
||
| 45 | $this->assertTrue($result->isSuccessful()); |
||
| 46 | $this->assertFalse($result->isFailure()); |
||
| 47 | $this->assertFalse($result->isException()); |
||
| 48 | $this->assertTrue($result->hasRun()); |
||
| 49 | $this->assertNull($result->getException()); |
||
| 50 | $this->assertNull($result->getOutput()); |
||
| 51 | $this->assertSame('Successful', $result->getDescription()); |
||
| 52 | $this->assertSame('Successful', (string) $result); |
||
| 53 | $this->assertSame(Result::SUCCESSFUL, $result->getType()); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @test |
||
| 58 | */ |
||
| 59 | public function can_create_failure() |
||
| 60 | { |
||
| 61 | $task = new MockTask(); |
||
| 62 | $result = Result::failure($task, 'some reason', 'some output'); |
||
| 63 | |||
| 64 | $this->assertSame($task, $result->getTask()); |
||
| 65 | $this->assertFalse($result->isSkipped()); |
||
| 66 | $this->assertFalse($result->isSuccessful()); |
||
| 67 | $this->assertTrue($result->isFailure()); |
||
| 68 | $this->assertFalse($result->isException()); |
||
| 69 | $this->assertTrue($result->hasRun()); |
||
| 70 | $this->assertNull($result->getException()); |
||
| 71 | $this->assertSame('some output', $result->getOutput()); |
||
| 72 | $this->assertSame('some reason', $result->getDescription()); |
||
| 73 | $this->assertSame('some reason', (string) $result); |
||
| 74 | $this->assertSame(Result::FAILED, $result->getType()); |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @test |
||
| 79 | */ |
||
| 80 | public function can_create_exception() |
||
| 81 | { |
||
| 82 | $task = new MockTask(); |
||
| 83 | $exception = new \RuntimeException('exception message'); |
||
| 84 | $result = Result::exception($task, $exception, 'some output'); |
||
| 85 | |||
| 86 | $this->assertSame($task, $result->getTask()); |
||
| 87 | $this->assertFalse($result->isSkipped()); |
||
| 88 | $this->assertFalse($result->isSuccessful()); |
||
| 89 | $this->assertTrue($result->isFailure()); |
||
| 90 | $this->assertTrue($result->isException()); |
||
| 91 | $this->assertTrue($result->hasRun()); |
||
| 92 | $this->assertSame($exception, $result->getException()); |
||
| 93 | $this->assertSame('some output', $result->getOutput()); |
||
| 94 | $this->assertSame('RuntimeException: exception message', $result->getDescription()); |
||
| 95 | $this->assertSame('RuntimeException: exception message', (string) $result); |
||
| 96 | $this->assertSame(Result::FAILED, $result->getType()); |
||
| 97 | } |
||
| 98 | } |
||
| 99 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths