Skip to content

Commit 2a21ec3

Browse files
committed
feat: add code style in test
1 parent 0c8bf14 commit 2a21ec3

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

phpcs.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@
4040
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
4141

4242
<file>src/</file>
43+
<file>tests/</file>
4344
</ruleset>

tests/Collection/ExtendedMockHttpClientCollectionTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,44 @@ class ExtendedMockHttpClientCollectionTest extends TestCase
1313
public function testSuccess(): void
1414
{
1515
$clientCollection = new ExtendedMockHttpClientCollection([]);
16-
16+
1717
$this->assertCount(0, $clientCollection->getHandlers());
1818
}
19-
19+
2020
public function testInitFailed(): void
2121
{
2222
$this->expectException(TypeError::class);
2323
new ExtendedMockHttpClientCollection('string');
2424
}
25-
25+
2626
public function testSetHandlersSuccess(): void
2727
{
2828
$clientCollection = new ExtendedMockHttpClientCollection([]);
29-
29+
3030
$this->assertCount(0, $clientCollection->getHandlers());
31-
31+
3232
$clientCollection->setHandlers([[]]);
33-
33+
3434
$this->assertCount(1, $clientCollection->getHandlers());
3535
}
36-
36+
3737
public function testSetHandlersFailed(): void
3838
{
3939
$this->expectException(TypeError::class);
4040
$clientCollection = new ExtendedMockHttpClientCollection([]);
41-
41+
4242
$this->assertCount(0, $clientCollection->getHandlers());
4343
$clientCollection->setHandlers('string');
4444
}
45-
45+
4646
public function testResetSuccess(): void
4747
{
4848
$clientCollection = new ExtendedMockHttpClientCollection([[]]);
49-
49+
5050
$this->assertCount(1, $clientCollection->getHandlers());
51-
51+
5252
$clientCollection->reset();
53-
53+
5454
$this->assertCount(0, $clientCollection->getHandlers());
5555
}
5656
}

tests/Context/MockContextTest.php

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testFailingObjectInCollection(): void
2424
$mockCollection = new ExtendedMockHttpClientCollection(
2525
['string']
2626
);
27-
27+
2828
$mockContext = new MockContext(
2929
new Container(),
3030
$mockCollection
@@ -34,7 +34,7 @@ public function testFailingObjectInCollection(): void
3434

3535
$mockContext->afterScenario();
3636
}
37-
37+
3838
public function testSuccess(): void
3939
{
4040
$client = new ExtendedMockHttpClient('http://test.test');
@@ -48,20 +48,19 @@ public function testSuccess(): void
4848
$mockCollection = new ExtendedMockHttpClientCollection([
4949
new ExtendedMockHttpClient('macpaw.com')
5050
]);
51-
51+
5252
$mockContext = new MockContext(
5353
new Container(),
5454
$mockCollection
5555
);
56-
56+
5757
self::assertCount(1, $mockCollection->getHandlers());
58-
58+
5959
$mockContext->afterScenario();
60-
60+
6161
self::assertCount(1, $mockCollection->getHandlers());
6262
}
63-
64-
63+
6564
public function testServiceNotFound(): void
6665
{
6766
$this->expectException(RuntimeException::class);
@@ -73,43 +72,43 @@ public function testServiceNotFound(): void
7372
'http_code' => 200
7473
])
7574
));
76-
75+
7776
$mockCollection = new ExtendedMockHttpClientCollection([
7877
new ExtendedMockHttpClient('macpaw.com')
7978
]);
80-
79+
8180
$mockContext = new MockContext(
8281
new Container(),
8382
$mockCollection
8483
);
85-
84+
8685
self::assertCount(1, $mockCollection->getHandlers());
87-
86+
8887
$mockContext->iMockHttpClientNextResponse('test', 204);
8988
}
90-
89+
9190
public function testFailedClientService(): void
9291
{
9392
$this->expectException(RuntimeException::class);
9493
$this->expectErrorMessage('You should replace HTTP client service using ExtendedMockHttpClient');
95-
94+
9695
$client = new ExtendedMockHttpClient('http://test.test');
9796
$client->addFixture(new HttpFixture(
9897
(new RequestMockBuilder())->build(),
9998
new MockResponse('response body', [
10099
'http_code' => 200
101100
])
102101
));
103-
102+
104103
$mockCollection = new ExtendedMockHttpClientCollection([
105104
new ExtendedMockHttpClient('macpaw.com')
106105
]);
107-
106+
108107
$container = new Container();
109108
$container->set('test', new stdClass());
110109

111110
$mockContext = new MockContext($container, $mockCollection);
112-
111+
113112
$mockContext->iMockHttpClientNextResponse('test', 204);
114113
}
115114
}

0 commit comments

Comments
 (0)