Skip to content

Commit 2687cdb

Browse files
committed
clean up
1 parent d1ad915 commit 2687cdb

4 files changed

+63
-5
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
namespace ErrorHeroModule\Spec\Integration;
4+
5+
use ErrorHeroModule\Command\Preview\ErrorPreviewConsoleCommand;
6+
use Laminas\Db\Adapter\AdapterInterface;
7+
use Laminas\Db\ResultSet\ResultSet;
8+
use Laminas\Db\TableGateway\TableGateway;
9+
use Laminas\Mvc\Application;
10+
use Symfony\Component\Console\Tester\CommandTester;
11+
use Throwable;
12+
13+
describe('Integration via ErrorPreviewConsoleCommand', function (): void {
14+
15+
given('application', function () {
16+
17+
$application = Application::init([
18+
'modules' => [
19+
'Laminas\Router',
20+
'Laminas\Db',
21+
'ErrorHeroModule',
22+
],
23+
'module_listener_options' => [
24+
'config_glob_paths' => [
25+
\realpath(__DIR__).'/../Fixture/config/autoload-for-enable-display-errors/error-hero-module.local.php',
26+
\realpath(__DIR__).'/../Fixture/config/module.local.php',
27+
],
28+
],
29+
]);
30+
31+
$serviceManager = $application->getServiceManager();
32+
$db = $serviceManager->get(AdapterInterface::class);
33+
$tableGateway = new TableGateway('log', $db, null, new ResultSet());
34+
$tableGateway->delete([]);
35+
36+
return $application;
37+
38+
});
39+
40+
describe('error-preview error excluded', function(): void {
41+
42+
it('show error', function(): void {
43+
44+
try {
45+
/** @var ErrorPreviewConsoleCommand $command */
46+
$command = $this->application->getServiceManager()->get(ErrorPreviewConsoleCommand::class);
47+
48+
$commandTester = new CommandTester($command);
49+
$commandTester->execute([
50+
'type' => 'error',
51+
]);
52+
53+
} catch (Throwable $throwable) {
54+
expect($throwable->getMessage())->toBe('a sample error preview');
55+
}
56+
57+
});
58+
});
59+
60+
});

spec/Integration/IntegrationViaErrorPreviewConsoleCommandExcludeExceptionSpec.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
use Laminas\Db\TableGateway\TableGateway;
99
use Laminas\Mvc\Application;
1010
use Symfony\Component\Console\Tester\CommandTester;
11-
use Kahlan\Plugin\Quit;
12-
use Kahlan\QuitException;
1311
use Throwable;
1412

15-
describe('Integration via ErrorPreviewConsoleController', function (): void {
13+
describe('Integration via ErrorPreviewConsoleCommand', function (): void {
1614

1715
given('application', function () {
1816

spec/Integration/IntegrationViaErrorPreviewConsoleCommandSpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Laminas\Mvc\Application;
1010
use Symfony\Component\Console\Tester\CommandTester;
1111

12-
describe('Integration via ErrorPreviewConsoleController', function (): void {
12+
describe('Integration via ErrorPreviewConsoleCommand', function (): void {
1313

1414
given('application', function () {
1515

spec/Integration/IntegrationViaErrorPreviewConsoleCommandWithDoctrineORMModuleSpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Laminas\Mvc\Application;
88
use Symfony\Component\Console\Tester\CommandTester;
99

10-
describe('Integration via ErrorPreviewConsoleController with doctrine', function (): void {
10+
describe('Integration via ErrorPreviewConsoleCommand with doctrine', function (): void {
1111

1212
given('application', function () {
1313

0 commit comments

Comments
 (0)