Skip to content

Commit b402565

Browse files
committed
coding style updates
1 parent 4596af7 commit b402565

2 files changed

Lines changed: 36 additions & 36 deletions

File tree

tests/unit/BasicTest.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ public function setUp(): void
5757
BackgroundProcessing::reset();
5858
}
5959

60+
/**
61+
* @param array<array{0: \Closure, ?mixed}> $closures
62+
* @dataProvider dataRun
63+
* @covers \CrowdStar\BackgroundProcessing\BackgroundProcessing::run()
64+
* @throws AlreadyInvokedException|InvalidEnvironmentException
65+
*/
66+
public function testRun(int $expected, array $closures, string $message): void
67+
{
68+
foreach ($closures as $closure) {
69+
BackgroundProcessing::add(...$closure);
70+
}
71+
BackgroundProcessing::run();
72+
$this->assertSame($expected, self::$counter, $message);
73+
}
74+
6075
/**
6176
* @return array<array<mixed>>
6277
*/
@@ -101,21 +116,6 @@ public static function dataRun(): array
101116
];
102117
}
103118

104-
/**
105-
* @param array<array{0: \Closure, ?mixed}> $closures
106-
* @dataProvider dataRun
107-
* @covers \CrowdStar\BackgroundProcessing\BackgroundProcessing::run()
108-
* @throws AlreadyInvokedException|InvalidEnvironmentException
109-
*/
110-
public function testRun(int $expected, array $closures, string $message): void
111-
{
112-
foreach ($closures as $closure) {
113-
BackgroundProcessing::add(...$closure);
114-
}
115-
BackgroundProcessing::run();
116-
$this->assertSame($expected, self::$counter, $message);
117-
}
118-
119119
/**
120120
* @covers \CrowdStar\BackgroundProcessing\BackgroundProcessing::run()
121121
*/

tests/unit/DockerizedTest.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,27 @@
3232
*/
3333
class DockerizedTest extends TestCase
3434
{
35+
/**
36+
* @dataProvider dataRun
37+
* @covers \CrowdStar\BackgroundProcessing\BackgroundProcessing::run()
38+
*/
39+
public function testRun(string $expectedHttpResponse, string $expectedFinalValue, string $start, string $end): void
40+
{
41+
$client = new Client(['base_uri' => 'http://web']);
42+
$client->get('/', ['query' => ['reset' => true]]); // Wipe cached data.
43+
44+
$this->assertSame(
45+
$expectedHttpResponse,
46+
(string) $client->get('/', ['query' => ['start' => $start, 'end' => $end]])->getBody(),
47+
"HTTP response should be {$expectedHttpResponse} while final value in APCu should be {$expectedFinalValue}"
48+
);
49+
$this->assertSame(
50+
$expectedFinalValue,
51+
(string) $client->get('/')->getBody(),
52+
"Final value in APCu should be {$expectedFinalValue} while HTTP response should be {$expectedHttpResponse}"
53+
);
54+
}
55+
3556
/**
3657
* @return array<array<string, string>>
3758
*/
@@ -68,25 +89,4 @@ public static function dataRun(): array
6889
],
6990
];
7091
}
71-
72-
/**
73-
* @dataProvider dataRun
74-
* @covers \CrowdStar\BackgroundProcessing\BackgroundProcessing::run()
75-
*/
76-
public function testRun(string $expectedHttpResponse, string $expectedFinalValue, string $start, string $end): void
77-
{
78-
$client = new Client(['base_uri' => 'http://web']);
79-
$client->get('/', ['query' => ['reset' => true]]); // Wipe cached data.
80-
81-
$this->assertSame(
82-
$expectedHttpResponse,
83-
(string) $client->get('/', ['query' => ['start' => $start, 'end' => $end]])->getBody(),
84-
"HTTP response should be {$expectedHttpResponse} while final value in APCu should be {$expectedFinalValue}"
85-
);
86-
$this->assertSame(
87-
$expectedFinalValue,
88-
(string) $client->get('/')->getBody(),
89-
"Final value in APCu should be {$expectedFinalValue} while HTTP response should be {$expectedHttpResponse}"
90-
);
91-
}
9292
}

0 commit comments

Comments
 (0)