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.

ProcedureFactoryTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 105
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8

Importance

Changes 0
Metric Value
dl 0
loc 105
c 0
b 0
f 0
wmc 7
lcom 1
cbo 8
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testFactoryCanCreateInstanceOfProcedure() 0 11 1
A getProcedureFactory() 0 6 1
A getEngine() 0 6 1
A getParser() 0 6 1
A getCache() 0 6 2
A getRenderer() 0 10 1
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 Twig_Environment;
12
use Twig_Loader_String;
13
use JonnyW\PhantomJs\Engine;
14
use JonnyW\PhantomJs\Cache\FileCache;
15
use JonnyW\PhantomJs\Cache\CacheInterface;
16
use JonnyW\PhantomJs\Parser\JsonParser;
17
use JonnyW\PhantomJs\Parser\ParserInterface;
18
use JonnyW\PhantomJs\Template\TemplateRenderer;
19
use JonnyW\PhantomJs\Template\TemplateRendererInterface;
20
use JonnyW\PhantomJs\Procedure\ProcedureFactory;
21
22
/**
23
 * PHP PhantomJs
24
 *
25
 * @author Jon Wenmoth <[email protected]>
26
 */
27
class ProcedureFactoryTest extends \PHPUnit_Framework_TestCase
28
{
29
30
/** +++++++++++++++++++++++++++++++++++ **/
31
/** ++++++++++++++ TESTS ++++++++++++++ **/
32
/** +++++++++++++++++++++++++++++++++++ **/
33
34
    /**
35
     * Test factory can create instance of
36
     * procedure.
37
     *
38
     * @access public
39
     * @return void
40
     */
41
    public function testFactoryCanCreateInstanceOfProcedure()
42
    {
43
        $engine    = $this->getEngine();
44
        $parser    = $this->getParser();
45
        $cache     = $this->getCache();
46
        $renderer  = $this->getRenderer();
47
48
        $procedureFactory = $this->getProcedureFactory($engine, $parser, $cache, $renderer);
49
50
        $this->assertInstanceOf('\JonnyW\PhantomJs\Procedure\Procedure', $procedureFactory->createProcedure());
51
    }
52
53
/** +++++++++++++++++++++++++++++++++++ **/
54
/** ++++++++++ TEST ENTITIES ++++++++++ **/
55
/** +++++++++++++++++++++++++++++++++++ **/
56
57
    /**
58
     * Get procedure factory instance.
59
     *
60
     * @access protected
61
     * @param  \JonnyW\PhantomJs\Engine                             $engine
62
     * @param  \JonnyW\PhantomJs\Parser\ParserInterface             $parser
63
     * @param  \JonnyW\PhantomJs\Cache\CacheInterface               $cacheHandler
64
     * @param  \JonnyW\PhantomJs\Template\TemplateRendererInterface $renderer
65
     * @return \JonnyW\PhantomJs\Procedure\ProcedureFactory
66
     */
67
    protected function getProcedureFactory(Engine $engine, ParserInterface $parser, CacheInterface $cacheHandler, TemplateRendererInterface $renderer)
68
    {
69
        $procedureFactory = new ProcedureFactory($engine, $parser, $cacheHandler, $renderer);
70
71
        return $procedureFactory;
72
    }
73
74
    /**
75
     * Get engine.
76
     *
77
     * @access protected
78
     * @return \JonnyW\PhantomJs\Engine
79
     */
80
    protected function getEngine()
81
    {
82
        $engine = new Engine();
83
84
        return $engine;
85
    }
86
87
    /**
88
     * Get parser.
89
     *
90
     * @access protected
91
     * @return \JonnyW\PhantomJs\Parser\JsonParser
92
     */
93
    protected function getParser()
94
    {
95
        $parser = new JsonParser();
96
97
        return $parser;
98
    }
99
100
    /**
101
     * Get cache.
102
     *
103
     * @access protected
104
     * @param  string                            $cacheDir  (default: '')
105
     * @param  string                            $extension (default: 'proc')
106
     * @return \JonnyW\PhantomJs\Cache\FileCache
107
     */
108
    protected function getCache($cacheDir = '', $extension = 'proc')
0 ignored issues
show
Unused Code introduced by
The parameter $extension is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
109
    {
110
        $cache = new FileCache(($cacheDir ? $cacheDir : sys_get_temp_dir()), 'proc');
111
112
        return $cache;
113
    }
114
115
    /**
116
     * Get template renderer.
117
     *
118
     * @access protected
119
     * @return \JonnyW\PhantomJs\Template\TemplateRenderer
120
     */
121
    protected function getRenderer()
122
    {
123
        $twig = new Twig_Environment(
124
            new Twig_Loader_String()
0 ignored issues
show
Deprecated Code introduced by
The class Twig_Loader_String has been deprecated with message: since 1.18.1 (to be removed in 2.0)

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
125
        );
126
127
        $renderer = new TemplateRenderer($twig);
128
129
        return $renderer;
130
    }
131
}
132