Completed
Push — master ( 9ab4b9...065cdd )
by Alejandro
09:44
created

LoggerFactoryTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
namespace ShlinkioTest\Shlink\Common\Factory;
3
4
use Monolog\Logger;
5
use PHPUnit_Framework_TestCase as TestCase;
6
use Psr\Log\LoggerInterface;
7
use Shlinkio\Shlink\Common\Factory\LoggerFactory;
8
use Zend\ServiceManager\ServiceManager;
9
10
class LoggerFactoryTest extends TestCase
11
{
12
    /**
13
     * @var LoggerFactory
14
     */
15
    protected $factory;
16
17
    public function setUp()
18
    {
19
        $this->factory = new LoggerFactory();
20
    }
21
22
    /**
23
     * @test
24
     */
25 View Code Duplication
    public function serviceIsCreated()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
26
    {
27
        /** @var Logger $instance */
28
        $instance = $this->factory->__invoke(new ServiceManager(), '');
29
        $this->assertInstanceOf(LoggerInterface::class, $instance);
30
        $this->assertEquals('Logger', $instance->getName());
31
    }
32
33
    /**
34
     * @test
35
     */
36 View Code Duplication
    public function nameIsSetFromOptions()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
        /** @var Logger $instance */
39
        $instance = $this->factory->__invoke(new ServiceManager(), '', ['logger_name' => 'Foo']);
40
        $this->assertInstanceOf(LoggerInterface::class, $instance);
41
        $this->assertEquals('Foo', $instance->getName());
42
    }
43
44
    /**
45
     * @test
46
     */
47 View Code Duplication
    public function serviceNameOverwritesOptionsLoggerName()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49
        /** @var Logger $instance */
50
        $instance = $this->factory->__invoke(new ServiceManager(), 'Logger_Shlink', ['logger_name' => 'Foo']);
51
        $this->assertInstanceOf(LoggerInterface::class, $instance);
52
        $this->assertEquals('Shlink', $instance->getName());
53
    }
54
}
55