Completed
Pull Request — master (#6)
by Tomáš
05:24
created

testHaveNotMissingArgumentsTypehints()   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()
0 ignored issues
show
Unused Code Comprehensibility introduced by
52% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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