Completed
Pull Request — master (#912)
by
unknown
07:49
created

AutoloadRestorerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A creation() 0 6 1
A restoration() 0 19 1
1
<?php
2
/**
3
 * this file is part of magerun
4
 *
5
 * @author Tom Klingenberg <https://github.com/ktomk>
6
 */
7
8
namespace N98\Util;
9
10
/**
11
 * Class AutoloadRestorerTest
12
 *
13
 * @package N98\Util
14
 */
15
class AutoloadRestorerTest extends \PHPUnit_Framework_TestCase
16
{
17
    /**
18
     * @test
19
     */
20
    public function creation()
21
    {
22
        $restorer = new AutoloadRestorer();
23
24
        $this->assertInstanceOf('N98\Util\AutoloadRestorer', $restorer);
25
    }
26
27
    /**
28
     * @test
29
     */
30
    public function restoration()
31
    {
32
        $callbackStub = function () {
33
        };
34
35
        $this->assertTrue(spl_autoload_register($callbackStub));
36
37
        $restorer = new AutoloadRestorer();
38
39
        $this->assertTrue(in_array($callbackStub, spl_autoload_functions(), true));
40
41
        $this->assertTrue(spl_autoload_unregister($callbackStub));
42
43
        $this->assertFalse(in_array($callbackStub, spl_autoload_functions(), true));
44
45
        $restorer->restore();
46
47
        $this->assertTrue(in_array($callbackStub, spl_autoload_functions(), true));
48
    }
49
}
50