Passed
Push — master ( 18c542...46352d )
by Kevin
02:34
created

TimezoneTest::can_set_a_default_timezone()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 13
rs 9.9666
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Zenstruck\ScheduleBundle\Tests\Functional;
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\TimezoneSubscriber;
7
use Zenstruck\ScheduleBundle\Tests\Fixture\MockScheduleBuilder;
8
use Zenstruck\ScheduleBundle\Tests\Fixture\MockTask;
9
10
/**
11
 * @author Kevin Bond <[email protected]>
12
 */
13
final class TimezoneTest extends TestCase
14
{
15
    /**
16
     * @test
17
     */
18
    public function can_set_a_default_timezone()
19
    {
20
        $tasks = (new MockScheduleBuilder())
21
            ->addTask(new MockTask())
22
            ->addTask((new MockTask())->timezone('America/New_York'))
23
            ->addSubscriber(new TimezoneSubscriber('UTC'))
24
            ->getRunner()
25
            ->buildSchedule()
26
            ->all()
27
        ;
28
29
        $this->assertSame('UTC', $tasks[0]->getTimezone()->getName());
30
        $this->assertSame('America/New_York', $tasks[1]->getTimezone()->getName());
31
    }
32
}
33