Passed
Push — master ( aa061c...2e1140 )
by Jakub
02:07
created

ContainerSuiteFactoryTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCreate() 0 15 1
1
<?php
2
declare(strict_types=1);
3
4
namespace MyTester\Bridges\NetteDI;
5
6
use MyTester\Attributes\TestSuite;
7
use MyTester\InvalidTestCaseException;
8
use MyTester\TestCase;
9
10
/**
11
 * Test suite for class ContainerSuiteFactory
12
 *
13
 * @author Jakub Konečný
14
 */
15
#[TestSuite("ContainerSuiteFactoryTest")]
16
final class ContainerSuiteFactoryTest extends TestCase
17
{
18
    public function testCreate(): void
19
    {
20
        // @phpstan-ignore argument.type
21
        $factory = new ContainerSuiteFactory([
22
            new static(),
23
            new \stdClass(),
24
        ]);
25
        $this->assertType(static::class, $factory->create(static::class));
26
        $this->assertThrowsException(function () use ($factory) {
27
            $factory->create(\stdClass::class);
28
        }, InvalidTestCaseException::class, "stdClass is not a descendant of MyTester\\TestCase.");
29
        $this->assertThrowsException(function () use ($factory) {
30
            // @phpstan-ignore argument.type
31
            $factory->create("abcd");
32
        }, InvalidTestCaseException::class, "abcd is not a descendant of MyTester\\TestCase.");
33
    }
34
}
35