These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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'); |
||
0 ignored issues
–
show
|
|||
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->createMock('\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 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.