Passed
Push — master ( 751812...ad3fb0 )
by Kevin
02:24
created

ScheduleExtensionSubscriberTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 21
rs 10
c 0
b 0
f 0
eloc 8

3 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ can_configure_schedule_with_subscriber() 0 16 1
can_configure_schedule_with_subscriber() 0 16 ?
A hp$0 ➔ __toString() 0 3 1
1
<?php
2
3
namespace Zenstruck\ScheduleBundle\Tests\EventListener;
4
5
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Zenstruck\ScheduleBundle\EventListener\ScheduleExtensionSubscriber;
7
use Zenstruck\ScheduleBundle\Schedule\Extension;
8
use Zenstruck\ScheduleBundle\Tests\Fixture\MockScheduleBuilder;
9
10
/**
11
 * @author Kevin Bond <[email protected]>
12
 */
13
final class ScheduleExtensionSubscriberTest extends TestCase
14
{
15
    /**
16
     * @test
17
     */
18
    public function can_configure_schedule_with_subscriber()
19
    {
20
        $extension = new class() implements Extension {
21
            public function __toString(): string
22
            {
23
                return 'my extension';
24
            }
25
        };
26
27
        $schedule = (new MockScheduleBuilder())
28
            ->addSubscriber(new ScheduleExtensionSubscriber([$extension]))
29
            ->getRunner()
30
            ->buildSchedule()
31
        ;
32
33
        $this->assertSame($extension, $schedule->getExtensions()[0]);
34
    }
35
}
36