Skip to content

Commit 3c2186b

Browse files
committed
Formatting for tests
1 parent ad3fbf9 commit 3c2186b

17 files changed

+63
-84
lines changed

tests/src/Functional/CortexTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
*/
2727
class CortexTest extends TestCaseFunctional
2828
{
29-
3029
public function testBootOnce()
3130
{
3231
$boot1 = Cortex::boot();
@@ -254,7 +253,7 @@ public function testCortexNotMatchBecauseUrlChangedViaFilter()
254253
}));
255254
});
256255

257-
Filters::expectApplied('cortex.uri.instance')->once()->andReturnUsing(function() {
256+
Filters::expectApplied('cortex.uri.instance')->once()->andReturnUsing(function () {
258257
$uri = \Mockery::mock(Cortex\Uri\UriInterface::class);
259258
$uri->shouldReceive('scheme')->andReturn('http');
260259
$uri->shouldReceive('host')->andReturn('example.com');
@@ -288,7 +287,7 @@ public function testCortexMatchWhenUrlChangedViaFilterIsInvalid()
288287
}));
289288
});
290289

291-
Filters::expectApplied('cortex.uri.instance')->once()->andReturnUsing(function() {
290+
Filters::expectApplied('cortex.uri.instance')->once()->andReturnUsing(function () {
292291
return 'http://example.com/foo/bar/baz';
293292
});
294293

@@ -302,4 +301,4 @@ public function testCortexMatchWhenUrlChangedViaFilterIsInvalid()
302301
assertSame(['post_type' => 'products'], $wp->query_vars);
303302
assertFalse($do);
304303
}
305-
}
304+
}

tests/src/Functional/RoutesTest.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,26 @@ public function testAddRoutesAndGroups()
5858

5959
$routeAdders = $groupAdders = [];
6060

61-
Actions::expectAdded('cortex.routes')->twice()->whenHappen(function($add) use(&$routeAdders) {
61+
Actions::expectAdded('cortex.routes')->twice()->whenHappen(function ($add) use (&$routeAdders) {
6262
$routeAdders[] = $add;
6363
});
6464

65-
Actions::expectAdded('cortex.groups')->once()->whenHappen(function($add) use(&$groupAdders) {
65+
Actions::expectAdded('cortex.groups')->once()->whenHappen(function ($add) use (&$groupAdders) {
6666
$groupAdders[] = $add;
6767
});
6868

6969
Actions::expectFired('cortex.routes')
7070
->once()
71-
->whenHappen(function (RouteCollectionInterface $routes) use(&$routeAdders) {
72-
foreach($routeAdders as $routeAdder) {
71+
->whenHappen(function (RouteCollectionInterface $routes) use (&$routeAdders) {
72+
foreach ($routeAdders as $routeAdder) {
7373
$routeAdder($routes);
7474
}
7575
});
7676

7777
Actions::expectFired('cortex.groups')
7878
->once()
79-
->whenHappen(function (GroupCollectionInterface $groups) use(&$groupAdders) {
80-
foreach($groupAdders as $groupAdder) {
79+
->whenHappen(function (GroupCollectionInterface $groups) use (&$groupAdders) {
80+
foreach ($groupAdders as $groupAdder) {
8181
$groupAdder($groups);
8282
}
8383
});
@@ -100,11 +100,11 @@ public function testMatchRedirectRoute()
100100
/** @var callable|null $factory */
101101
$factory = null;
102102

103-
Actions::expectAdded('cortex.routes')->once()->whenHappen(function($cb) use(&$factory) {
103+
Actions::expectAdded('cortex.routes')->once()->whenHappen(function ($cb) use (&$factory) {
104104
$factory = $cb;
105105
});
106106

107-
Actions::expectFired('cortex.routes')->once()->whenHappen(function ($routes) use(&$factory) {
107+
Actions::expectFired('cortex.routes')->once()->whenHappen(function ($routes) use (&$factory) {
108108
$factory($routes);
109109
});
110110

@@ -121,5 +121,4 @@ public function testMatchRedirectRoute()
121121

122122
assertTrue($do);
123123
}
124-
125-
}
124+
}

tests/src/TestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
*/
2020
class TestCase extends \PHPUnit_Framework_TestCase
2121
{
22-
2322
protected function setUp()
2423
{
2524
parent::setUp();

tests/src/TestCaseFunctional.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
*/
2323
class TestCaseFunctional extends TestCase
2424
{
25-
2625
protected static function buildPsrRequest($url, $method = 'GET')
2726
{
2827
$parts = parse_url($url);

tests/src/Unit/Controller/QueryVarsControllerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
class QueryVarsControllerTest extends TestCase
2222
{
23-
2423
public function testRun()
2524
{
2625
$wp = \Mockery::mock('WP');
@@ -31,4 +30,4 @@ public function testRun()
3130
assertFalse($result);
3231
assertSame(['foo' => 'bar'], $wp->query_vars);
3332
}
34-
}
33+
}

tests/src/Unit/Controller/RedirectControllerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
*/
2323
class RedirectControllerTest extends TestCase
2424
{
25-
2625
public function testRunDoNothingIfRedirectToIsInvalid()
2726
{
2827
Actions::expectAdded('cortex.exit.redirect')->never();
@@ -60,7 +59,7 @@ public function testRunAllStatusSettings()
6059
$data = [
6160
'redirect_to' => 'https://example.com',
6261
'redirect_status' => 307,
63-
'redirect_external' => true
62+
'redirect_external' => true,
6463
];
6564

6665
$wp = \Mockery::mock('WP');
@@ -69,4 +68,4 @@ public function testRunAllStatusSettings()
6968

7069
assertTrue($controller->run($data, $wp));
7170
}
72-
}
71+
}

tests/src/Unit/Group/GroupCollectionTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*/
2626
class GroupCollectionTest extends TestCase
2727
{
28-
2928
public function testAddGroup()
3029
{
3130
$group = \Mockery::mock(GroupInterface::class);
@@ -47,27 +46,27 @@ public function testMergeGroup()
4746
'id' => 'my_route',
4847
'group' => 'test_group',
4948
'vars' => [
50-
'foo' => 'bar'
51-
]
49+
'foo' => 'bar',
50+
],
5251
]);
5352

5453
$group = new Group([
5554
'id' => 'test_group',
5655
'handler' => 'my_handler',
5756
'host' => 'example.com',
5857
'vars' => [
59-
'meh' => 'meh'
60-
]
58+
'meh' => 'meh',
59+
],
6160
]);
6261

6362
$expected = [
6463
'id' => 'my_route',
6564
'group' => 'test_group',
6665
'vars' => [
67-
'foo' => 'bar'
66+
'foo' => 'bar',
6867
],
6968
'handler' => 'my_handler',
70-
'host' => 'example.com'
69+
'host' => 'example.com',
7170
];
7271

7372
$collection = new GroupCollection();
@@ -104,7 +103,7 @@ public function testMergeMultipleGroups()
104103
$group2 = new Group([
105104
'id' => 'group_2',
106105
'paged' => false,
107-
'merge_query_string' => true
106+
'merge_query_string' => true,
108107
]);
109108

110109
$expected = [
@@ -130,4 +129,4 @@ public function testMergeMultipleGroups()
130129

131130
assertSame($expected, $actual);
132131
}
133-
}
132+
}

tests/src/Unit/Group/GroupTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
class GroupTest extends TestCase
2222
{
23-
2423
public function testIdWhenGiven()
2524
{
2625
$group = new Group(['id' => 'test_me']);
@@ -46,15 +45,15 @@ public function testToArrayStripsInvalid()
4645
'handler' => '__return_true',
4746
'meh' => 'meh',
4847
'priority' => 0,
49-
'id' => 'test_me'
48+
'id' => 'test_me',
5049
]);
5150

5251
$expected = [
5352
'vars' => [],
5453
'path' => '/',
5554
'handler' => '__return_true',
5655
'priority' => 0,
57-
'id' => 'test_me'
56+
'id' => 'test_me',
5857
];
5958

6059
assertSame($expected, $group->toArray());
@@ -69,7 +68,7 @@ public function testArrayAccess()
6968
'path' => '/',
7069
'handler' => '__return_true',
7170
'meh' => 'meh',
72-
'priority' => 0
71+
'priority' => 0,
7372
]);
7473

7574
assertFalse($group->offsetExists('foo'));
@@ -90,5 +89,4 @@ public function testArrayAccess()
9089
assertFalse($group->offsetExists('vars'));
9190
assertSame('__return_true', $group['handler']);
9291
}
93-
94-
}
92+
}

tests/src/Unit/Route/PriorityRouteCollectionTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
class PriorityRouteCollectionTest extends TestCase
2525
{
26-
2726
public function testAddRoute()
2827
{
2928
$route1 = new Route(['id' => 'r_1']);
@@ -72,7 +71,7 @@ public function testPagedSingle()
7271
$route = new Route([
7372
'id' => 'route_example',
7473
'path' => '/foo',
75-
'paged' => RouteInterface::PAGED_SINGLE
74+
'paged' => RouteInterface::PAGED_SINGLE,
7675
]);
7776

7877
$collection = new PriorityRouteCollection();
@@ -100,7 +99,7 @@ public function testPagedArchive()
10099
'id' => 'route_example',
101100
'path' => '/bar',
102101
'priority' => 32,
103-
'paged' => RouteInterface::PAGED_ARCHIVE
102+
'paged' => RouteInterface::PAGED_ARCHIVE,
104103
]);
105104

106105
$collection = new PriorityRouteCollection();
@@ -121,5 +120,4 @@ public function testPagedArchive()
121120
$i++;
122121
}
123122
}
124-
125-
}
123+
}

tests/src/Unit/Route/QueryRouteTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
*/
2222
class QueryRouteTest extends TestCase
2323
{
24-
2524
public function testArrayAccess()
2625
{
2726
$vars = function (array $vars) {
@@ -89,5 +88,4 @@ public function testId()
8988
assertStringMatchesFormat('route_%s', $route1->id());
9089
assertSame('route_2', $route2->id());
9190
}
92-
93-
}
91+
}

0 commit comments

Comments
 (0)