Skip to content

Commit c8a48fd

Browse files
More tests
1 parent 7554807 commit c8a48fd

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

tests/Doubles/Fakes/vendor/Illuminate/ApplicationFake.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313

1414
class ApplicationFake extends ArrayObject implements Application
1515
{
16+
private $isConsole;
17+
1618
private $registered = [];
1719

18-
public function __construct(?array $array = null)
20+
public function __construct(?array $array = null, ?bool $isConsole = null)
1921
{
2022
parent::__construct($array ?? []);
23+
$this->isConsole = $isConsole ?? true;
2124
}
2225

2326
public function addContextualBinding($concrete, $abstract, $implementation)
@@ -215,6 +218,7 @@ public function routesAreCached()
215218

216219
public function runningInConsole()
217220
{
221+
return $this->isConsole;
218222
}
219223

220224
public function runningUnitTests()

tests/Unit/Providers/ConsoleLoggServiceProviderTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,19 @@ public function testRegisterBindings(): void
6262
$app->get(FilterableConsoleLoggerFactoryInterface::class)
6363
);
6464
}
65+
66+
public function testRegisterDoesNothingForNonConsole(): void
67+
{
68+
$app = new ApplicationFake(null, false);
69+
$serviceProvider = new ConsoleLoggServiceProvider($app);
70+
71+
$serviceProvider->register();
72+
73+
self::assertNotSame(LogOutputBinder::class, $app->get(LogOutputBindedInterface::class));
74+
self::assertNotSame(LogManagerResolverListener::class, $app->get(LogManagerResolverListenerInterface::class));
75+
self::assertNotSame(
76+
FilterableConsoleLoggerFactory::class,
77+
$app->get(FilterableConsoleLoggerFactoryInterface::class)
78+
);
79+
}
6580
}

0 commit comments

Comments
 (0)