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

ContainerSuiteFactoryTest::testCreate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 10
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 15
rs 9.9332
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