@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | $service = Mockery::mock(Service::class); |
26 | 26 | $serviceHost = Mockery::mock(ServiceHost::class); |
27 | - $serviceHost->shouldReceive('where->first')->andReturn((object) ['service' => $service]); |
|
27 | + $serviceHost->shouldReceive('where->first')->andReturn((object) [ 'service' => $service ]); |
|
28 | 28 | app()->instance(ServiceHost::class, $serviceHost); |
29 | 29 | $this->assertEquals($service, app()->make(ServiceRepository::class)->getServiceByUrl('http://www.baidu.com')); |
30 | 30 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $serviceRepository = Mockery::mock(ServiceRepository::class) |
42 | 42 | ->makePartial() |
43 | 43 | ->shouldReceive('getServiceByUrl') |
44 | - ->andReturn((object) ['enabled' => true]) |
|
44 | + ->andReturn((object) [ 'enabled' => true ]) |
|
45 | 45 | ->getMock(); |
46 | 46 | $this->assertTrue($serviceRepository->isUrlValid('http://www.baidu.com')); |
47 | 47 | } |
@@ -18,14 +18,14 @@ |
||
18 | 18 | $resp->setFailure('code1', 'desc1'); |
19 | 19 | $data = $this->getData($resp); |
20 | 20 | $this->assertEquals( |
21 | - ['serviceResponse' => ['authenticationFailure' => ['code' => 'code1', 'description' => 'desc1']]], |
|
21 | + [ 'serviceResponse' => [ 'authenticationFailure' => [ 'code' => 'code1', 'description' => 'desc1' ] ] ], |
|
22 | 22 | $data |
23 | 23 | ); |
24 | 24 | |
25 | 25 | $resp->setFailure('code2', 'desc2'); |
26 | 26 | $data = $this->getData($resp); |
27 | 27 | $this->assertEquals( |
28 | - ['serviceResponse' => ['authenticationFailure' => ['code' => 'code2', 'description' => 'desc2']]], |
|
28 | + [ 'serviceResponse' => [ 'authenticationFailure' => [ 'code' => 'code2', 'description' => 'desc2' ] ] ], |
|
29 | 29 | $data |
30 | 30 | ); |
31 | 31 | } |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $serializableModel = new SerializableModel(); |
45 | 45 | $resource = fopen(__FILE__, 'a'); |
46 | 46 | $this->assertEquals('string', $method->invoke($this->testObj, 'string')); |
47 | - $this->assertEquals(json_encode([1, 2, 3]), $method->invoke($this->testObj, [1, 2, 3])); |
|
48 | - $this->assertEquals(json_encode(['key' => 'value']), $method->invoke($this->testObj, ['key' => 'value'])); |
|
47 | + $this->assertEquals(json_encode([ 1, 2, 3 ]), $method->invoke($this->testObj, [ 1, 2, 3 ])); |
|
48 | + $this->assertEquals(json_encode([ 'key' => 'value' ]), $method->invoke($this->testObj, [ 'key' => 'value' ])); |
|
49 | 49 | $this->assertEquals( |
50 | - json_encode(['key' => 'value']), |
|
51 | - $method->invoke($this->testObj, (object) ['key' => 'value']) |
|
50 | + json_encode([ 'key' => 'value' ]), |
|
51 | + $method->invoke($this->testObj, (object) [ 'key' => 'value' ]) |
|
52 | 52 | ); |
53 | 53 | $this->assertEquals($objWithToString->__toString(), $method->invoke($this->testObj, $objWithToString)); |
54 | 54 | $this->assertEquals(serialize($serializableModel), $method->invoke($this->testObj, $serializableModel)); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | public function testToResponse() |
90 | 90 | { |
91 | - $resp = Mockery::mock(BaseXmlResponse::class, []) |
|
91 | + $resp = Mockery::mock(BaseXmlResponse::class, [ ]) |
|
92 | 92 | ->makePartial() |
93 | 93 | ->shouldAllowMockingProtectedMethods() |
94 | 94 | ->shouldReceive('removeXmlFirstLine') |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | $resp = new JsonAuthenticationSuccessResponse(); |
18 | 18 | $resp->setUser('test name'); |
19 | 19 | $data = $this->getData($resp); |
20 | - $this->assertEquals(['serviceResponse' => ['authenticationSuccess' => ['user' => 'test name']]], $data); |
|
20 | + $this->assertEquals([ 'serviceResponse' => [ 'authenticationSuccess' => [ 'user' => 'test name' ] ] ], $data); |
|
21 | 21 | $resp->setUser('test name2'); |
22 | 22 | $data = $this->getData($resp); |
23 | - $this->assertEquals(['serviceResponse' => ['authenticationSuccess' => ['user' => 'test name2']]], $data); |
|
23 | + $this->assertEquals([ 'serviceResponse' => [ 'authenticationSuccess' => [ 'user' => 'test name2' ] ] ], $data); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function testSetProxyGrantingTicket() |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | $resp->setProxyGrantingTicket('ticket1'); |
30 | 30 | $data = $this->getData($resp); |
31 | 31 | $this->assertEquals( |
32 | - ['serviceResponse' => ['authenticationSuccess' => ['proxyGrantingTicket' => 'ticket1']]], |
|
32 | + [ 'serviceResponse' => [ 'authenticationSuccess' => [ 'proxyGrantingTicket' => 'ticket1' ] ] ], |
|
33 | 33 | $data |
34 | 34 | ); |
35 | 35 | $resp->setProxyGrantingTicket('ticket2'); |
36 | 36 | $data = $this->getData($resp); |
37 | 37 | $this->assertEquals( |
38 | - ['serviceResponse' => ['authenticationSuccess' => ['proxyGrantingTicket' => 'ticket2']]], |
|
38 | + [ 'serviceResponse' => [ 'authenticationSuccess' => [ 'proxyGrantingTicket' => 'ticket2' ] ] ], |
|
39 | 39 | $data |
40 | 40 | ); |
41 | 41 | } |
@@ -43,29 +43,29 @@ discard block |
||
43 | 43 | public function testSetProxies() |
44 | 44 | { |
45 | 45 | $resp = new JsonAuthenticationSuccessResponse(); |
46 | - $proxies1 = ['http://proxy1.com', 'http://proxy2.com']; |
|
46 | + $proxies1 = [ 'http://proxy1.com', 'http://proxy2.com' ]; |
|
47 | 47 | $resp->setProxies($proxies1); |
48 | 48 | $data = $this->getData($resp); |
49 | - $this->assertEquals(['serviceResponse' => ['authenticationSuccess' => ['proxies' => $proxies1]]], $data); |
|
49 | + $this->assertEquals([ 'serviceResponse' => [ 'authenticationSuccess' => [ 'proxies' => $proxies1 ] ] ], $data); |
|
50 | 50 | |
51 | - $proxies2 = ['http://proxy3.com', 'http://proxy4.com']; |
|
51 | + $proxies2 = [ 'http://proxy3.com', 'http://proxy4.com' ]; |
|
52 | 52 | $resp->setProxies($proxies2); |
53 | 53 | $data = $this->getData($resp); |
54 | - $this->assertEquals(['serviceResponse' => ['authenticationSuccess' => ['proxies' => $proxies2]]], $data); |
|
54 | + $this->assertEquals([ 'serviceResponse' => [ 'authenticationSuccess' => [ 'proxies' => $proxies2 ] ] ], $data); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | public function testSetAttributes() |
58 | 58 | { |
59 | 59 | $resp = new JsonAuthenticationSuccessResponse(); |
60 | - $attr1 = ['key1' => 'value1', 'key2' => 'value2']; |
|
60 | + $attr1 = [ 'key1' => 'value1', 'key2' => 'value2' ]; |
|
61 | 61 | $resp->setAttributes($attr1); |
62 | 62 | $data = $this->getData($resp); |
63 | - $this->assertEquals(['serviceResponse' => ['authenticationSuccess' => ['attributes' => $attr1]]], $data); |
|
63 | + $this->assertEquals([ 'serviceResponse' => [ 'authenticationSuccess' => [ 'attributes' => $attr1 ] ] ], $data); |
|
64 | 64 | |
65 | - $attr2 = ['key3' => 'value3', 'key4' => 'value4']; |
|
65 | + $attr2 = [ 'key3' => 'value3', 'key4' => 'value4' ]; |
|
66 | 66 | $resp->setAttributes($attr2); |
67 | 67 | $data = $this->getData($resp); |
68 | - $this->assertEquals(['serviceResponse' => ['authenticationSuccess' => ['attributes' => $attr2]]], $data); |
|
68 | + $this->assertEquals([ 'serviceResponse' => [ 'authenticationSuccess' => [ 'attributes' => $attr2 ] ] ], $data); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | protected function getData(JsonAuthenticationSuccessResponse $resp) |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | public function testToResponse() |
17 | 17 | { |
18 | - $data = ['something' => 'test']; |
|
18 | + $data = [ 'something' => 'test' ]; |
|
19 | 19 | $resp = new BaseJsonResponse(); |
20 | 20 | $property = self::getNonPublicProperty($resp, 'data'); |
21 | 21 | $property->setValue($resp, $data); |
@@ -6,12 +6,12 @@ |
||
6 | 6 | ]; |
7 | 7 | |
8 | 8 | if (config('cas.middleware.common')) { |
9 | - $options['middleware'] = config('cas.middleware.common'); |
|
9 | + $options[ 'middleware' ] = config('cas.middleware.common'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | Route::group( |
13 | 13 | $options, |
14 | - function () { |
|
14 | + function() { |
|
15 | 15 | $auth = config('cas.middleware.auth'); |
16 | 16 | $p = config('cas.router.name_prefix'); |
17 | 17 | Route::get('login', 'SecurityController@showLogin')->name($p.'login.get'); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | return $this->authFailureResponse($e->getCasErrorCode(), $e->getMessage(), $format); |
190 | 190 | } |
191 | 191 | |
192 | - $proxies = []; |
|
192 | + $proxies = [ ]; |
|
193 | 193 | if ($record->isProxy()) { |
194 | 194 | $proxies = $record->proxies; |
195 | 195 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | - $attr = $returnAttr ? $record->user->getCASAttributes() : []; |
|
216 | + $attr = $returnAttr ? $record->user->getCASAttributes() : [ ]; |
|
217 | 217 | |
218 | 218 | return $this->authSuccessResponse($record->user->getName(), $format, $attr, $proxies, $iou); |
219 | 219 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @param string|null $pgt |
227 | 227 | * @return Response |
228 | 228 | */ |
229 | - protected function authSuccessResponse($username, $format, $attributes, $proxies = [], $pgt = null) |
|
229 | + protected function authSuccessResponse($username, $format, $attributes, $proxies = [ ], $pgt = null) |
|
230 | 230 | { |
231 | 231 | if (strtoupper($format) === 'JSON') { |
232 | 232 | $resp = app(JsonAuthenticationSuccessResponse::class); |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | { |
31 | 31 | protected $table = 'cas_proxy_granting_tickets'; |
32 | 32 | public $timestamps = false; |
33 | - protected $fillable = ['ticket', 'pgt_url', 'proxies', 'expire_at', 'created_at']; |
|
33 | + protected $fillable = [ 'ticket', 'pgt_url', 'proxies', 'expire_at', 'created_at' ]; |
|
34 | 34 | |
35 | 35 | public function getProxiesAttribute() |
36 | 36 | { |
37 | - $ret = json_decode($this->attributes['proxies'], true); |
|
37 | + $ret = json_decode($this->attributes[ 'proxies' ], true); |
|
38 | 38 | if (!$ret) { |
39 | - return []; |
|
39 | + return [ ]; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return $ret; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function setProxiesAttribute($value) |
46 | 46 | { |
47 | - $this->attributes['proxies'] = json_encode($value); |
|
47 | + $this->attributes[ 'proxies' ] = json_encode($value); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function isExpired() |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | protected $table = 'cas_tickets'; |
32 | 32 | public $timestamps = false; |
33 | - protected $fillable = ['ticket', 'service_url', 'proxies', 'expire_at', 'created_at']; |
|
33 | + protected $fillable = [ 'ticket', 'service_url', 'proxies', 'expire_at', 'created_at' ]; |
|
34 | 34 | |
35 | 35 | public function getProxiesAttribute() |
36 | 36 | { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | return null; |
39 | 39 | } |
40 | 40 | |
41 | - return json_decode($this->attributes['proxies'], true); |
|
41 | + return json_decode($this->attributes[ 'proxies' ], true); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function setProxiesAttribute($value) |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if ($this->id && !$this->isProxy()) { |
47 | 47 | return; |
48 | 48 | } |
49 | - $this->attributes['proxies'] = json_encode($value); |
|
49 | + $this->attributes[ 'proxies' ] = json_encode($value); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function isExpired() |
@@ -66,6 +66,6 @@ discard block |
||
66 | 66 | |
67 | 67 | public function isProxy() |
68 | 68 | { |
69 | - return !is_null($this->attributes['proxies']); |
|
69 | + return !is_null($this->attributes[ 'proxies' ]); |
|
70 | 70 | } |
71 | 71 | } |