@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | public function providePaginatorCreationData() |
50 | 50 | { |
51 | 51 | return [ |
52 | - [ 'Test/Paginator', ['test' => 'value'], ['merged' => 'yes'], false, ['page' => 1, 'count' => 10, 'range' => 5] ], |
|
53 | - [ 'Test2/YetAnotherPager', ['page' => 2], [], true, ['page' => 2, 'count' => 10, 'range' => 5] ], |
|
54 | - [ 'Yet/Another', ['page' => 3, 'count' => 90, 'range' => 2], false, false, ['page' => 3, 'count' => 90, 'range' => 2] ], |
|
55 | - [ 'Even/Another', ['test' => 'value'], [], new \ArrayObject(['test' => 'value']), ['page' => 1, 'count' => 10, 'range' => 5]], |
|
52 | + ['Test/Paginator', ['test' => 'value'], ['merged' => 'yes'], false, ['page' => 1, 'count' => 10, 'range' => 5]], |
|
53 | + ['Test2/YetAnotherPager', ['page' => 2], [], true, ['page' => 2, 'count' => 10, 'range' => 5]], |
|
54 | + ['Yet/Another', ['page' => 3, 'count' => 90, 'range' => 2], false, false, ['page' => 3, 'count' => 90, 'range' => 2]], |
|
55 | + ['Even/Another', ['test' => 'value'], [], new \ArrayObject(['test' => 'value']), ['page' => 1, 'count' => 10, 'range' => 5]], |
|
56 | 56 | ]; |
57 | 57 | } |
58 | 58 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | public function testPaginatorCreation($paginatorName, $params, $defaultParams, $usePostParams, $expect) |
71 | 71 | { |
72 | 72 | if ($defaultParams) { $options = array_merge($params, $defaultParams); } |
73 | - else { $options = $params; } |
|
73 | + else { $options = $params; } |
|
74 | 74 | $request = new Request(); |
75 | 75 | if ($usePostParams) { |
76 | 76 | $request->setPost(new Parameters($params)); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $em = $this->getMockBuilder(EventManager::class) |
104 | 104 | ->disableOriginalConstructor() |
105 | - ->setMethods(['getEvent','triggerEvent']) |
|
105 | + ->setMethods(['getEvent', 'triggerEvent']) |
|
106 | 106 | ->getMock() |
107 | 107 | ; |
108 | 108 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | ->willReturn($repositories) |
38 | 38 | ; |
39 | 39 | $ob = FileSender::factory($container); |
40 | - $this->assertInstanceOf(FileSender::class,$ob); |
|
40 | + $this->assertInstanceOf(FileSender::class, $ob); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function testSendFile() |
@@ -61,34 +61,34 @@ discard block |
||
61 | 61 | ; |
62 | 62 | $repo->expects($this->any()) |
63 | 63 | ->method('find') |
64 | - ->willReturn(null,$file) |
|
64 | + ->willReturn(null, $file) |
|
65 | 65 | ; |
66 | 66 | |
67 | 67 | $sender = new FileSender($repositories); |
68 | 68 | $sender->setController($controller); |
69 | 69 | |
70 | 70 | // fist test: response will be 404 if file is not found |
71 | - $sender('someRepository',$fileId); |
|
72 | - $this->assertEquals(404,$response->getStatusCode()); |
|
71 | + $sender('someRepository', $fileId); |
|
72 | + $this->assertEquals(404, $response->getStatusCode()); |
|
73 | 73 | |
74 | 74 | // second test: will handle send file properly |
75 | 75 | $file->expects($this->any()) |
76 | 76 | ->method('__get') |
77 | 77 | ->willReturnMap([ |
78 | - ['type','type'], |
|
79 | - ['size','size'] |
|
78 | + ['type', 'type'], |
|
79 | + ['size', 'size'] |
|
80 | 80 | ]) |
81 | 81 | ; |
82 | - $resource = fopen(__FILE__,'r'); |
|
82 | + $resource = fopen(__FILE__, 'r'); |
|
83 | 83 | $file->expects($this->once()) |
84 | 84 | ->method('getResource') |
85 | 85 | ->willReturn($resource) |
86 | 86 | ; |
87 | 87 | ob_start(); |
88 | - $sender('someRepository',$fileId); |
|
88 | + $sender('someRepository', $fileId); |
|
89 | 89 | $output = ob_get_contents(); |
90 | 90 | ob_end_clean(); |
91 | 91 | |
92 | - $this->assertStringEqualsFile(__FILE__,$output); |
|
92 | + $this->assertStringEqualsFile(__FILE__, $output); |
|
93 | 93 | } |
94 | 94 | } |
@@ -90,20 +90,20 @@ discard block |
||
90 | 90 | $this->viewResolver->expects($this->any()) |
91 | 91 | ->method('resolve') |
92 | 92 | ->willReturnMap([ |
93 | - ['mail/null-template',null,null], |
|
94 | - ['coretest/mail/null-template',null,__DIR__.'/fixtures/mail-template.phtml'], |
|
95 | - ['mail/template',null,__DIR__.'/fixtures/mail-template.phtml'], |
|
96 | - ['mail/exception',null,__DIR__.'/fixtures/error.phtml'] |
|
93 | + ['mail/null-template', null, null], |
|
94 | + ['coretest/mail/null-template', null, __DIR__.'/fixtures/mail-template.phtml'], |
|
95 | + ['mail/template', null, __DIR__.'/fixtures/mail-template.phtml'], |
|
96 | + ['mail/exception', null, __DIR__.'/fixtures/error.phtml'] |
|
97 | 97 | ]) |
98 | 98 | ; |
99 | 99 | |
100 | 100 | $container->expects($this->any()) |
101 | 101 | ->method('get') |
102 | 102 | ->willReturnMap([ |
103 | - ['Log/Core/Mail',$this->mailLog], |
|
104 | - ['ViewResolver',$this->viewResolver], |
|
105 | - ['EventManager',$this->events], |
|
106 | - ['ModuleManager',$this->moduleManager] |
|
103 | + ['Log/Core/Mail', $this->mailLog], |
|
104 | + ['ViewResolver', $this->viewResolver], |
|
105 | + ['EventManager', $this->events], |
|
106 | + ['ModuleManager', $this->moduleManager] |
|
107 | 107 | ]) |
108 | 108 | ; |
109 | 109 | |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | public function testTemplate() |
132 | 132 | { |
133 | 133 | $target = $this->target; |
134 | - $params = ['Hello' => 'World','this'=>'this should not rendered']; |
|
134 | + $params = ['Hello' => 'World', 'this'=>'this should not rendered']; |
|
135 | 135 | |
136 | 136 | $target($params); |
137 | 137 | $target->template('null-template'); |
138 | 138 | |
139 | - $this->assertInstanceOf(Sendmail::class,$target->getTransport()); |
|
140 | - $this->assertSame($this->controller,$target->getController()); |
|
141 | - $this->assertContains('Hello World!',$target->getBody()); |
|
142 | - $this->assertNotContains($params['this'],$target->getBody()); |
|
139 | + $this->assertInstanceOf(Sendmail::class, $target->getTransport()); |
|
140 | + $this->assertSame($this->controller, $target->getController()); |
|
141 | + $this->assertContains('Hello World!', $target->getBody()); |
|
142 | + $this->assertNotContains($params['this'], $target->getBody()); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | public function testTemplateThrowExceptionWhenTemplateFileError() |
@@ -175,24 +175,24 @@ discard block |
||
175 | 175 | /** |
176 | 176 | * @dataProvider getTestInformationCompleteException |
177 | 177 | */ |
178 | - public function testInformationCompleteException($remove,$message) |
|
178 | + public function testInformationCompleteException($remove, $message) |
|
179 | 179 | { |
180 | 180 | $srcFile = __DIR__.'/fixtures/mail-template.phtml'; |
181 | 181 | $tplFile = sys_get_temp_dir().'/yawik/mail-template.phtml'; |
182 | 182 | |
183 | 183 | $contents = file_get_contents($srcFile); |
184 | 184 | $pattern = "/^.*".preg_quote($remove).".*$/m"; |
185 | - $contents = preg_replace($pattern,'',$contents); |
|
186 | - if(!is_dir($dir = dirname($tplFile))){ |
|
187 | - mkdir($dir,0777,true); |
|
185 | + $contents = preg_replace($pattern, '', $contents); |
|
186 | + if (!is_dir($dir = dirname($tplFile))) { |
|
187 | + mkdir($dir, 0777, true); |
|
188 | 188 | } |
189 | - file_put_contents($tplFile,$contents,LOCK_EX); |
|
189 | + file_put_contents($tplFile, $contents, LOCK_EX); |
|
190 | 190 | |
191 | 191 | $resolver = $this->createMock(ResolverInterface::class); |
192 | 192 | $resolver->expects($this->any()) |
193 | 193 | ->method('resolve') |
194 | 194 | ->willReturnMap([ |
195 | - ['mail/exception',null,$tplFile] |
|
195 | + ['mail/exception', null, $tplFile] |
|
196 | 196 | ]) |
197 | 197 | ; |
198 | 198 | |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | public function getTestInformationCompleteException() |
221 | 221 | { |
222 | 222 | return [ |
223 | - ['$from','A from email address'], |
|
224 | - ['$fromName','A from name'], |
|
225 | - ['$subject','A subject must be'], |
|
223 | + ['$from', 'A from email address'], |
|
224 | + ['$fromName', 'A from name'], |
|
225 | + ['$subject', 'A subject must be'], |
|
226 | 226 | ]; |
227 | 227 | } |
228 | 228 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | 'Hello' => 'World' |
246 | 246 | ]); |
247 | 247 | $target->setTransport($transport); |
248 | - $target->getHeaders()->addHeaderLine('to','[email protected]'); |
|
248 | + $target->getHeaders()->addHeaderLine('to', '[email protected]'); |
|
249 | 249 | $target->template('template'); |
250 | 250 | $this->assertTrue($target->send()); |
251 | 251 | $this->assertContains( |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $viewModel = new ViewModel(); |
46 | 46 | $events->expects($this->any()) |
47 | 47 | ->method('trigger') |
48 | - ->with($event,'some_target') |
|
48 | + ->with($event, 'some_target') |
|
49 | 49 | ->willReturn([ |
50 | - 'test_template',$viewModel |
|
50 | + 'test_template', $viewModel |
|
51 | 51 | ]) |
52 | 52 | ; |
53 | 53 | |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | $target->captureTo('some_path'); |
59 | 59 | |
60 | 60 | /* @var \Zend\View\Model\ViewModel[] $childs */ |
61 | - $output = $target->trigger($event,'some_target'); |
|
61 | + $output = $target->trigger($event, 'some_target'); |
|
62 | 62 | $childs = $output->getChildren(); |
63 | - $this->assertInstanceOf(ViewModel::class,$output); |
|
63 | + $this->assertInstanceOf(ViewModel::class, $output); |
|
64 | 64 | $this->assertEquals( |
65 | 65 | 'test_template', |
66 | 66 | $childs[0]->getTemplate() |
@@ -30,8 +30,8 @@ |
||
30 | 30 | ->willReturn([]) |
31 | 31 | ; |
32 | 32 | $factory = new ConfigFactory(); |
33 | - $service = $factory($container,'some'); |
|
33 | + $service = $factory($container, 'some'); |
|
34 | 34 | |
35 | - $this->assertInstanceOf(Config::class,$service); |
|
35 | + $this->assertInstanceOf(Config::class, $service); |
|
36 | 36 | } |
37 | 37 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | $container = $this->createMock(ContainerInterface::class); |
43 | 43 | $ob = ListQuery::factory($container); |
44 | - $this->assertInstanceOf(ListQuery::class,$ob); |
|
44 | + $this->assertInstanceOf(ListQuery::class, $ob); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function propertiesProvider() |
@@ -49,23 +49,23 @@ discard block |
||
49 | 49 | return [ |
50 | 50 | [ |
51 | 51 | 'pageParamName', |
52 | - ['value' => 'somePage','setter_value'=>null,'default'=>'page'] |
|
52 | + ['value' => 'somePage', 'setter_value'=>null, 'default'=>'page'] |
|
53 | 53 | ], |
54 | 54 | [ |
55 | - 'propertiesMap' , |
|
56 | - ['value'=>'bar','setter_value'=>null,'default'=>array()] |
|
55 | + 'propertiesMap', |
|
56 | + ['value'=>'bar', 'setter_value'=>null, 'default'=>array()] |
|
57 | 57 | ], |
58 | 58 | [ |
59 | 59 | 'itemsPerPage', |
60 | - ['value' => 10,'setter_value'=>null,'default' => 25] |
|
60 | + ['value' => 10, 'setter_value'=>null, 'default' => 25] |
|
61 | 61 | ], |
62 | 62 | [ |
63 | 63 | 'queryKeysLowercased', |
64 | - ['value' => false,'setter_value'=>null,'default' => true] |
|
64 | + ['value' => false, 'setter_value'=>null, 'default' => true] |
|
65 | 65 | ], |
66 | 66 | [ |
67 | 67 | 'sortParamName', |
68 | - ['value' => 's','setter_value'=>null,'default' => 'sort'] |
|
68 | + ['value' => 's', 'setter_value'=>null, 'default' => 'sort'] |
|
69 | 69 | ], |
70 | 70 | ]; |
71 | 71 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $config = include __DIR__.'/fixtures/config-dump.php'; |
59 | 59 | $moduleManager = $this->createMock(ModuleManagerInterface::class); |
60 | - return new IndexController($moduleManager,$config); |
|
60 | + return new IndexController($moduleManager, $config); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * @param string $module |
66 | 66 | * @dataProvider getTestInvoke |
67 | 67 | */ |
68 | - public function testInvoke($config,$key=null,$module=null,$expected) |
|
68 | + public function testInvoke($config, $key = null, $module = null, $expected) |
|
69 | 69 | { |
70 | 70 | $plugin = new Config($config); |
71 | 71 | $plugin->setController($this->getController()); |
72 | - $value = $plugin($key,$module); |
|
72 | + $value = $plugin($key, $module); |
|
73 | 73 | $this |
74 | - ->assertEquals($expected,$value) |
|
74 | + ->assertEquals($expected, $value) |
|
75 | 75 | ; |
76 | 76 | } |
77 | 77 | |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | ]; |
88 | 88 | |
89 | 89 | return [ |
90 | - [ $config, 'dashboard', 'Jobs', $config['Jobs']['dashboard'] ], |
|
91 | - [ $config, 'dashboard', ['Jobs','Applications'], $combinedOutput ], |
|
92 | - [ $config, 'settings', null, $config['Core']['settings'] ], |
|
93 | - [ $config, 'Core', true, $config['Core'] ], |
|
94 | - [ $config, ['dashboard','form'],['Jobs','Application'], ['Jobs' =>$config['Jobs']] ], |
|
90 | + [$config, 'dashboard', 'Jobs', $config['Jobs']['dashboard']], |
|
91 | + [$config, 'dashboard', ['Jobs', 'Applications'], $combinedOutput], |
|
92 | + [$config, 'settings', null, $config['Core']['settings']], |
|
93 | + [$config, 'Core', true, $config['Core']], |
|
94 | + [$config, ['dashboard', 'form'], ['Jobs', 'Application'], ['Jobs' =>$config['Jobs']]], |
|
95 | 95 | ]; |
96 | 96 | } |
97 | 97 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $plugin->setController($this->getController()); |
103 | 103 | |
104 | 104 | $this |
105 | - ->assertEquals($config['Core']['settings'],$plugin->settings) |
|
105 | + ->assertEquals($config['Core']['settings'], $plugin->settings) |
|
106 | 106 | ; |
107 | 107 | } |
108 | 108 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'class' => '\Core\Controller\Plugin\SearchForm', |
40 | 40 | 'args' => 'getTargetArgs', |
41 | 41 | '@testInvokationProxiesToGet' => [ |
42 | - 'mock' => [ 'get' ], |
|
42 | + 'mock' => ['get'], |
|
43 | 43 | 'args' => false, |
44 | 44 | ], |
45 | 45 | '@testInheritance' => [ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ], |
48 | 48 | ]; |
49 | 49 | |
50 | - protected $inheritance = [ AbstractPlugin::class ]; |
|
50 | + protected $inheritance = [AbstractPlugin::class]; |
|
51 | 51 | |
52 | 52 | protected function getTargetArgs() |
53 | 53 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function testInvokationProxiesToGet() |
64 | 64 | { |
65 | 65 | $form = 'TestForm'; |
66 | - $options = ['test' => 'test']; |
|
66 | + $options = ['test' => 'test']; |
|
67 | 67 | |
68 | 68 | $this->target->expects($this->once())->method('get')->with($form, $options); |
69 | 69 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | ], |
46 | 46 | ]; |
47 | 47 | |
48 | - protected $inheritance = [ '\Zend\Mvc\Controller\Plugin\AbstractPlugin' ]; |
|
48 | + protected $inheritance = ['\Zend\Mvc\Controller\Plugin\AbstractPlugin']; |
|
49 | 49 | |
50 | 50 | public function testInvokationWithoutArgumentsReturnsSelf() |
51 | 51 | { |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | public function argumentsStackProvider() |
92 | 92 | { |
93 | 93 | return [ |
94 | - [ 'paginator', ['paginator'], ['as' => 'paginator', 'paginator', []] ], |
|
95 | - [ 'paginator', ['name', 'alias'], ['as' => 'alias', 'name', []] ], |
|
96 | - [ 'paginator', ['name', ['param' => 'value'], 'alias'], ['as' => 'alias', 'name', ['param' => 'value']] ], |
|
97 | - [ 'paginator', ['name', []], ['as' => 'paginator', 'name', []]], |
|
98 | - [ 'form', ['formName'], ['as' => 'searchform', 'formName', null]], |
|
99 | - [ 'form', ['formName', ['testOpt' => 'testVal']], ['as' => 'searchform', 'formName', ['testOpt' => 'testVal']]], |
|
100 | - [ 'form', ['formName', null, 'alias'], ['as' => 'alias', 'formName', null]], |
|
101 | - [ 'form', ['formName', 'alias'], ['as' => 'alias', 'formName', null]], |
|
102 | - [ 'params', ['namespace'], ['namespace', ['page' => 1]]], |
|
103 | - [ 'params', ['namespace', ['param' => 'value']], ['namespace', ['param' => 'value']]], |
|
94 | + ['paginator', ['paginator'], ['as' => 'paginator', 'paginator', []]], |
|
95 | + ['paginator', ['name', 'alias'], ['as' => 'alias', 'name', []]], |
|
96 | + ['paginator', ['name', ['param' => 'value'], 'alias'], ['as' => 'alias', 'name', ['param' => 'value']]], |
|
97 | + ['paginator', ['name', []], ['as' => 'paginator', 'name', []]], |
|
98 | + ['form', ['formName'], ['as' => 'searchform', 'formName', null]], |
|
99 | + ['form', ['formName', ['testOpt' => 'testVal']], ['as' => 'searchform', 'formName', ['testOpt' => 'testVal']]], |
|
100 | + ['form', ['formName', null, 'alias'], ['as' => 'alias', 'formName', null]], |
|
101 | + ['form', ['formName', 'alias'], ['as' => 'alias', 'formName', null]], |
|
102 | + ['params', ['namespace'], ['namespace', ['page' => 1]]], |
|
103 | + ['params', ['namespace', ['param' => 'value']], ['namespace', ['param' => 'value']]], |
|
104 | 104 | ]; |
105 | 105 | } |
106 | 106 | |
@@ -124,14 +124,14 @@ discard block |
||
124 | 124 | { |
125 | 125 | $this->target->expects($this->exactly(2))->method('paginator') |
126 | 126 | ->withConsecutive( |
127 | - [ 'Name' ], |
|
128 | - [ 'Name', 'Alias'] |
|
127 | + ['Name'], |
|
128 | + ['Name', 'Alias'] |
|
129 | 129 | )->willReturn($this->returnSelf()); |
130 | 130 | |
131 | 131 | $this->target->expects($this->exactly(2))->method('form') |
132 | 132 | ->withConsecutive( |
133 | - [ 'Name' ], |
|
134 | - [ 'Name', 'Alias'] |
|
133 | + ['Name'], |
|
134 | + ['Name', 'Alias'] |
|
135 | 135 | )->willReturn($this->returnSelf()); |
136 | 136 | |
137 | 137 | $stack = [ |