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

WithoutOverlappingExtensionTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A can_use_handler_to_configure_lock_factory() 0 14 1
1
<?php
2
3
namespace Zenstruck\ScheduleBundle\Tests\Schedule\Extension;
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 Psr\Log\Test\TestLogger;
7
use Symfony\Component\Lock\LockFactory;
8
use Symfony\Component\Lock\Store\FlockStore;
9
use Zenstruck\ScheduleBundle\Schedule\Extension\Handler\WithoutOverlappingHandler;
10
use Zenstruck\ScheduleBundle\Tests\Fixture\MockScheduleBuilder;
11
use Zenstruck\ScheduleBundle\Tests\Fixture\MockTask;
12
13
/**
14
 * @author Kevin Bond <[email protected]>
15
 */
16
final class WithoutOverlappingExtensionTest extends TestCase
17
{
18
    /**
19
     * @test
20
     */
21
    public function can_use_handler_to_configure_lock_factory()
22
    {
23
        $logger = new TestLogger();
24
        $lockFactory = new LockFactory(new FlockStore());
25
        $lockFactory->setLogger($logger);
26
27
        (new MockScheduleBuilder())
28
            ->addHandler(new WithoutOverlappingHandler($lockFactory))
29
            ->addTask((new MockTask())->withoutOverlapping())
30
            ->run()
31
        ;
32
33
        $this->assertTrue($logger->hasInfoThatContains('Successfully acquired'));
34
        $this->assertTrue($logger->hasInfoThatContains('Expiration defined'));
35
    }
36
}
37