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

TimezoneTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 10
c 0
b 0
f 0
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A can_set_a_default_timezone() 0 13 1
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