Completed
Push — master ( 3bca0f...4b95a7 )
by Tomáš
05:03 queued 02:28
created

testHaveMissingArgumentsTypehints()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 7
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Symplify\DefaultAutowire\Tests\DependencyInjection\Definition;
4
5
use PHPUnit\Framework\TestCase;
6
use Symfony\Component\DependencyInjection\Definition;
7
use Symplify\DefaultAutowire\DependencyInjection\Definition\DefinitionAnalyzer;
8
use Symplify\DefaultAutowire\DependencyInjection\Definition\DefinitionValidator;
9
use Symplify\DefaultAutowire\Tests\DependencyInjection\Definition\DefinitionAnalyzerSource\EmptyConstructor;
10
use Symplify\DefaultAutowire\Tests\DependencyInjection\Definition\DefinitionAnalyzerSource\MissingArgumentsTypehints;
11
use Symplify\DefaultAutowire\Tests\DependencyInjection\Definition\DefinitionAnalyzerSource\NotMissingArgumentsTypehints;
12
13
final class DefinitionAnalyzerTest extends TestCase
14
{
15
    /**
16
     * @var DefinitionAnalyzer
17
     */
18
    private $definitionAnalyzer;
19
20
    protected function setUp()
21
    {
22
        $this->definitionAnalyzer = new DefinitionAnalyzer(new DefinitionValidator());
23
    }
24
25
    public function testHasConstructorArguments()
26
    {
27
        $definition = new Definition(EmptyConstructor::class);
28
        $this->assertFalse($this->definitionAnalyzer->shouldDefinitionBeAutowired($definition));
29
    }
30
31
    public function testHaveMissingArgumentsTypehints()
32
    {
33
        $definition = new Definition(MissingArgumentsTypehints::class);
34
        $definition->setArguments(['@someService']);
35
36
        $this->assertFalse($this->definitionAnalyzer->shouldDefinitionBeAutowired($definition));
37
    }
38
39
    public function testHaveNotMissingArgumentsTypehints()
40
    {
41
        $definition = new Definition(NotMissingArgumentsTypehints::class);
42
        $definition->setArguments(['@someService']);
43
44
        $this->assertTrue($this->definitionAnalyzer->shouldDefinitionBeAutowired($definition));
45
    }
46
}
47