GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ProcedureLoaderFactoryTest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 101
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 101
c 0
b 0
f 0
wmc 6
lcom 1
cbo 2
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testInvalidArgumentExceptionIsThrownIfDirectoryIsNotReadableWhenCreatingProcedureLoader() 0 9 1
A testProcedureLoaderCanBeCreated() 0 9 1
A getProcedureLoaderFactory() 0 6 1
A getProcedureFactory() 0 6 1
A setUp() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the php-phantomjs.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
namespace JonnyW\PhantomJs\Tests\Unit\Procedure;
10
11
use JonnyW\PhantomJs\Procedure\ProcedureFactoryInterface;
12
use JonnyW\PhantomJs\Procedure\ProcedureLoaderFactory;
13
14
/**
15
 * PHP PhantomJs
16
 *
17
 * @author Jon Wenmoth <[email protected]>
18
 */
19
class ProcedureLoaderFactoryTest extends \PHPUnit_Framework_TestCase
20
{
21
    /**
22
     * Test directory
23
     *
24
     * @var string
25
     * @access protected
26
     */
27
    protected $directory;
28
29
/** +++++++++++++++++++++++++++++++++++ **/
30
/** ++++++++++++++ TESTS ++++++++++++++ **/
31
/** +++++++++++++++++++++++++++++++++++ **/
32
33
    /**
34
     * Test invalid argument exceptions is thrown if directory
35
     * is not readable when creating procedure loader.
36
     *
37
     * @access public
38
     * @return void
39
     */
40
    public function testInvalidArgumentExceptionIsThrownIfDirectoryIsNotReadableWhenCreatingProcedureLoader()
41
    {
42
        $this->setExpectedException('\InvalidArgumentException');
43
44
        $procedureFactory = $this->getProcedureFactory();
45
46
        $procedureLoaderFactory = $this->getProcedureLoaderFactory($procedureFactory);
47
        $procedureLoaderFactory->createProcedureLoader('invalid/directory');
48
    }
49
50
    /**
51
     * Test procedure loader can be created.
52
     *
53
     * @access public
54
     * @return void
55
     */
56
    public function testProcedureLoaderCanBeCreated()
57
    {
58
        $procedureFactory = $this->getProcedureFactory();
59
60
        $procedureLoaderFactory = $this->getProcedureLoaderFactory($procedureFactory);
61
        $procedureLoader = $procedureLoaderFactory->createProcedureLoader($this->directory);
62
63
        $this->assertInstanceOf('\JonnyW\PhantomJs\Procedure\ProcedureLoaderInterface', $procedureLoader);
64
    }
65
66
/** +++++++++++++++++++++++++++++++++++ **/
67
/** ++++++++++ TEST ENTITIES ++++++++++ **/
68
/** +++++++++++++++++++++++++++++++++++ **/
69
70
    /**
71
     * Get procedure loader factory instance.
72
     *
73
     * @access public
74
     * @param  \JonnyW\PhantomJs\Procedure\ProcedureFactoryInterface $procedureFactory
75
     * @return \JonnyW\PhantomJs\Procedure\ProcedureLoaderFactory
76
     */
77
    protected function getProcedureLoaderFactory(ProcedureFactoryInterface $procedureFactory)
78
    {
79
        $procedureLoaderFactory = new ProcedureLoaderFactory($procedureFactory);
80
81
        return $procedureLoaderFactory;
82
    }
83
84
/** +++++++++++++++++++++++++++++++++++ **/
85
/** ++++++++++ MOCKS / STUBS ++++++++++ **/
86
/** +++++++++++++++++++++++++++++++++++ **/
87
88
    /**
89
     * Get procedure factory.
90
     *
91
     * @access protected
92
     * @return \JonnyW\PhantomJs\Procedure\ProcedureFactoryInterface
93
     */
94
    protected function getProcedureFactory()
95
    {
96
        $procedureFactory = $this->getMock('\JonnyW\PhantomJs\Procedure\ProcedureFactoryInterface');
97
98
        return $procedureFactory;
99
    }
100
101
/** +++++++++++++++++++++++++++++++++++ **/
102
/** ++++++++++++ UTILITIES ++++++++++++ **/
103
/** +++++++++++++++++++++++++++++++++++ **/
104
105
    /**
106
     * Set up test environment.
107
     *
108
     * @access public
109
     * @return void
110
     */
111
    public function setUp()
112
    {
113
        $this->directory = sys_get_temp_dir();
114
115
        if (!is_readable($this->directory)) {
116
            throw new \RuntimeException(sprintf('Test directory must be readable: %s', $this->directory));
117
        }
118
    }
119
}
120