Skip to content

Commit f6d11b0

Browse files
committed
Add singleton/cache test for SupportedPhpExtensions
1 parent 0da060a commit f6d11b0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/Unit/Integrations/SupportedPhpExtensionsTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Mockery\MockInterface;
88

99
/**
10-
* @uses \BlameButton\LaravelDockerBuilder\DockerServiceProvider
10+
* @uses \BlameButton\LaravelDockerBuilder\DockerServiceProvider
1111
*
1212
* @covers \BlameButton\LaravelDockerBuilder\Integrations\SupportedPhpExtensions
1313
*/
@@ -50,7 +50,7 @@ public function testItFiltersVersions($expected, $version): void
5050

5151
public function testItReturnsEmptyArrayOnError(): void
5252
{
53-
$this->mock(SupportedPhpExtensions::class, function(MockInterface $mock) {
53+
$this->mock(SupportedPhpExtensions::class, function (MockInterface $mock) {
5454
$mock->shouldAllowMockingProtectedMethods();
5555
$mock->shouldReceive('get')->once()->passthru();
5656
$mock->shouldReceive('fetch')->once()->withNoArgs()->andReturn(false);
@@ -60,4 +60,16 @@ public function testItReturnsEmptyArrayOnError(): void
6060

6161
self::assertEquals([], $supported);
6262
}
63+
64+
public function testItCachesResponse(): void
65+
{
66+
$this->mock(SupportedPhpExtensions::class, function (MockInterface $mock) {
67+
$mock->shouldAllowMockingProtectedMethods();
68+
$mock->shouldReceive('get')->twice()->passthru();
69+
$mock->shouldReceive('fetch')->once()->andReturn();
70+
});
71+
72+
app(SupportedPhpExtensions::class)->get();
73+
app(SupportedPhpExtensions::class)->get();
74+
}
6375
}

0 commit comments

Comments
 (0)