Completed
Push — master ( eed6b4...fcc5fc )
by Aimeos
01:46
created
admin/jsonadm/tests/Admin/JsonAdm/Common/Factory/BaseTest.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -123,6 +123,9 @@
 block discarded – undo
123 123
 	}
124 124
 
125 125
 
126
+	/**
127
+	 * @param string $name
128
+	 */
126 129
 	protected function access( $name )
127 130
 	{
128 131
 		$class = new \ReflectionClass( \Aimeos\Admin\JsonAdm\Common\Factory\Base::class );
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -21,29 +21,29 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->client = new \Aimeos\Admin\JsonAdm\Product\Standard( $this->context, $this->view, [], '' );
24
+		$this->client = new \Aimeos\Admin\JsonAdm\Product\Standard($this->context, $this->view, [], '');
25 25
 
26
-		$this->object = $this->getMockBuilder( \Aimeos\Admin\JsonAdm\Common\Factory\Base::class )
26
+		$this->object = $this->getMockBuilder(\Aimeos\Admin\JsonAdm\Common\Factory\Base::class)
27 27
 			->getMockForAbstractClass();
28 28
 	}
29 29
 
30 30
 
31 31
 	public function testinjectClient()
32 32
 	{
33
-		$this->object->injectClient( 'test', $this->client );
33
+		$this->object->injectClient('test', $this->client);
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testAddClientDecorators()
38 38
 	{
39 39
 		$config = $this->context->getConfig();
40
-		$config->set( 'client/jsonapi/common/decorators/default', ['Test'] );
41
-		$config->set( 'client/jsonapi/product/decorators/excludes', ['Test'] );
40
+		$config->set('client/jsonapi/common/decorators/default', ['Test']);
41
+		$config->set('client/jsonapi/product/decorators/excludes', ['Test']);
42 42
 
43 43
 		$params = [$this->client, $this->context, $this->view, [], 'product'];
44
-		$result = $this->access( 'addClientDecorators' )->invokeArgs( $this->object, $params );
44
+		$result = $this->access('addClientDecorators')->invokeArgs($this->object, $params);
45 45
 
46
-		$this->assertInstanceOf( '\Aimeos\\Admin\\JsonAdm\\Iface', $result );
46
+		$this->assertInstanceOf('\Aimeos\\Admin\\JsonAdm\\Iface', $result);
47 47
 	}
48 48
 
49 49
 
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 		$prefix = '\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
53 53
 		$params = [$this->client, ['Example'], $prefix, $this->context, $this->view, [], ''];
54 54
 
55
-		$result = $this->access( 'addDecorators' )->invokeArgs( $this->object, $params );
55
+		$result = $this->access('addDecorators')->invokeArgs($this->object, $params);
56 56
 
57
-		$this->assertInstanceOf( '\Aimeos\\Admin\\JsonAdm\\Iface', $result );
57
+		$this->assertInstanceOf('\Aimeos\\Admin\\JsonAdm\\Iface', $result);
58 58
 	}
59 59
 
60 60
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		$prefix = '\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
64 64
 		$params = [$this->client, ['Test'], $prefix, $this->context, $this->view, [], ''];
65 65
 
66
-		$this->setExpectedException( \Aimeos\Admin\JsonAdm\Exception::class );
67
-		$this->access( 'addDecorators' )->invokeArgs( $this->object, $params );
66
+		$this->setExpectedException(\Aimeos\Admin\JsonAdm\Exception::class);
67
+		$this->access('addDecorators')->invokeArgs($this->object, $params);
68 68
 	}
69 69
 
70 70
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 		$prefix = '\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
74 74
 		$params = [$this->client, [''], $prefix, $this->context, $this->view, [], ''];
75 75
 
76
-		$this->setExpectedException( \Aimeos\Admin\JsonAdm\Exception::class );
77
-		$this->access( 'addDecorators' )->invokeArgs( $this->object, $params );
76
+		$this->setExpectedException(\Aimeos\Admin\JsonAdm\Exception::class);
77
+		$this->access('addDecorators')->invokeArgs($this->object, $params);
78 78
 	}
79 79
 
80 80
 
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 		$class = '\Aimeos\\Admin\\JsonAdm\\Product\\Standard';
85 85
 		$params = [$class, $iface, $this->context, $this->view, [], ''];
86 86
 
87
-		$result = $this->access( 'createClientBase' )->invokeArgs( $this->object, $params );
87
+		$result = $this->access('createClientBase')->invokeArgs($this->object, $params);
88 88
 
89
-		$this->assertInstanceOf( '\Aimeos\\Admin\\JsonAdm\\Iface', $result );
89
+		$this->assertInstanceOf('\Aimeos\\Admin\\JsonAdm\\Iface', $result);
90 90
 	}
91 91
 
92 92
 
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 		$iface = '\Aimeos\\Admin\\JsonAdm\\Iface';
96 96
 		$params = ['test', $iface, $this->context, $this->view, [], ''];
97 97
 
98
-		$this->object->injectClient( 'test', $this->client );
99
-		$result = $this->access( 'createClientBase' )->invokeArgs( $this->object, $params );
98
+		$this->object->injectClient('test', $this->client);
99
+		$result = $this->access('createClientBase')->invokeArgs($this->object, $params);
100 100
 
101
-		$this->assertSame( $this->client, $result );
101
+		$this->assertSame($this->client, $result);
102 102
 	}
103 103
 
104 104
 
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 		$iface = '\Aimeos\\Admin\\JsonAdm\\Iface';
108 108
 		$params = ['invalid', $iface, $this->context, $this->view, [], ''];
109 109
 
110
-		$this->setExpectedException( \Aimeos\Admin\JsonAdm\Exception::class );
111
-		$this->access( 'createClientBase' )->invokeArgs( $this->object, $params );
110
+		$this->setExpectedException(\Aimeos\Admin\JsonAdm\Exception::class);
111
+		$this->access('createClientBase')->invokeArgs($this->object, $params);
112 112
 	}
113 113
 
114 114
 
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
 		$class = '\Aimeos\\Admin\\JsonAdm\\Product\\Standard';
119 119
 		$params = [$class, $iface, $this->context, $this->view, [], ''];
120 120
 
121
-		$this->setExpectedException( \Aimeos\MW\Common\Exception::class );
122
-		$this->access( 'createClientBase' )->invokeArgs( $this->object, $params );
121
+		$this->setExpectedException(\Aimeos\MW\Common\Exception::class);
122
+		$this->access('createClientBase')->invokeArgs($this->object, $params);
123 123
 	}
124 124
 
125 125
 
126
-	protected function access( $name )
126
+	protected function access($name)
127 127
 	{
128
-		$class = new \ReflectionClass( \Aimeos\Admin\JsonAdm\Common\Factory\Base::class );
129
-		$method = $class->getMethod( $name );
130
-		$method->setAccessible( true );
128
+		$class = new \ReflectionClass(\Aimeos\Admin\JsonAdm\Common\Factory\Base::class);
129
+		$method = $class->getMethod($name);
130
+		$method->setAccessible(true);
131 131
 
132 132
 		return $method;
133 133
 	}
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Common/Decorator/BaseTest.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -21,88 +21,88 @@
 block discarded – undo
21 21
 		$context = \TestHelperJadm::getContext();
22 22
 		$this->view = $context->getView();
23 23
 
24
-		$this->stub = $this->getMockBuilder( '\\Aimeos\\Admin\\JsonAdm\\Standard' )
25
-			->setConstructorArgs( array( $context, $this->view, [], 'attribute' ) )
24
+		$this->stub = $this->getMockBuilder('\\Aimeos\\Admin\\JsonAdm\\Standard')
25
+			->setConstructorArgs(array($context, $this->view, [], 'attribute'))
26 26
 			->getMock();
27 27
 
28
-		$this->object = $this->getMockBuilder( '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\Base' )
29
-			->setConstructorArgs( [$this->stub, $context, $this->view, [], ''] )
28
+		$this->object = $this->getMockBuilder('\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\Base')
29
+			->setConstructorArgs([$this->stub, $context, $this->view, [], ''])
30 30
 			->getMockForAbstractClass();
31 31
 	}
32 32
 
33 33
 
34 34
 	protected function tearDown()
35 35
 	{
36
-		unset( $this->object, $this->stub, $this->view );
36
+		unset($this->object, $this->stub, $this->view);
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testDelete()
41 41
 	{
42
-		$this->stub->expects( $this->once() )->method( 'delete' )->will( $this->returnArgument( 1 ) );
42
+		$this->stub->expects($this->once())->method('delete')->will($this->returnArgument(1));
43 43
 		$response = $this->view->response();
44 44
 
45
-		$this->assertSame( $response, $this->object->delete( $this->view->request(), $response ) );
45
+		$this->assertSame($response, $this->object->delete($this->view->request(), $response));
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testGet()
50 50
 	{
51
-		$this->stub->expects( $this->once() )->method( 'get' )->will( $this->returnArgument( 1 ) );
51
+		$this->stub->expects($this->once())->method('get')->will($this->returnArgument(1));
52 52
 		$response = $this->view->response();
53 53
 
54
-		$this->assertSame( $response, $this->object->get( $this->view->request(), $response ) );
54
+		$this->assertSame($response, $this->object->get($this->view->request(), $response));
55 55
 	}
56 56
 
57 57
 
58 58
 	public function testPatch()
59 59
 	{
60
-		$this->stub->expects( $this->once() )->method( 'patch' )->will( $this->returnArgument( 1 ) );
60
+		$this->stub->expects($this->once())->method('patch')->will($this->returnArgument(1));
61 61
 		$response = $this->view->response();
62 62
 
63
-		$this->assertSame( $response, $this->object->patch( $this->view->request(), $response ) );
63
+		$this->assertSame($response, $this->object->patch($this->view->request(), $response));
64 64
 	}
65 65
 
66 66
 
67 67
 	public function testPost()
68 68
 	{
69
-		$this->stub->expects( $this->once() )->method( 'post' )->will( $this->returnArgument( 1 ) );
69
+		$this->stub->expects($this->once())->method('post')->will($this->returnArgument(1));
70 70
 		$response = $this->view->response();
71 71
 
72
-		$this->assertSame( $response, $this->object->post( $this->view->request(), $response ) );
72
+		$this->assertSame($response, $this->object->post($this->view->request(), $response));
73 73
 	}
74 74
 
75 75
 
76 76
 	public function testPut()
77 77
 	{
78
-		$this->stub->expects( $this->once() )->method( 'put' )->will( $this->returnArgument( 1 ) );
78
+		$this->stub->expects($this->once())->method('put')->will($this->returnArgument(1));
79 79
 		$response = $this->view->response();
80 80
 
81
-		$this->assertSame( $response, $this->object->put( $this->view->request(), $response ) );
81
+		$this->assertSame($response, $this->object->put($this->view->request(), $response));
82 82
 	}
83 83
 
84 84
 
85 85
 	public function testOptions()
86 86
 	{
87
-		$this->stub->expects( $this->once() )->method( 'options' )->will( $this->returnArgument( 1 ) );
87
+		$this->stub->expects($this->once())->method('options')->will($this->returnArgument(1));
88 88
 		$response = $this->view->response();
89 89
 
90
-		$this->assertSame( $response, $this->object->options( $this->view->request(), $response ) );
90
+		$this->assertSame($response, $this->object->options($this->view->request(), $response));
91 91
 	}
92 92
 
93 93
 
94 94
 	public function testGetClient()
95 95
 	{
96
-		$result = $this->access( 'getClient' )->invokeArgs( $this->object, [] );
97
-		$this->assertSame( $this->stub, $result );
96
+		$result = $this->access('getClient')->invokeArgs($this->object, []);
97
+		$this->assertSame($this->stub, $result);
98 98
 	}
99 99
 
100 100
 
101
-	protected function access( $name )
101
+	protected function access($name)
102 102
 	{
103
-		$class = new \ReflectionClass( \Aimeos\Admin\JsonAdm\Common\Decorator\Base::class );
104
-		$method = $class->getMethod( $name );
105
-		$method->setAccessible( true );
103
+		$class = new \ReflectionClass(\Aimeos\Admin\JsonAdm\Common\Decorator\Base::class);
104
+		$method = $class->getMethod($name);
105
+		$method->setAccessible(true);
106 106
 
107 107
 		return $method;
108 108
 	}
Please login to merge, or discard this patch.