-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathIntegrationViaErrorPreviewConsoleCommandWithDoctrineORMModuleSpec.php
More file actions
73 lines (51 loc) · 2.32 KB
/
IntegrationViaErrorPreviewConsoleCommandWithDoctrineORMModuleSpec.php
File metadata and controls
73 lines (51 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace ErrorHeroModule\Spec\Integration;
use Doctrine\ORM\EntityManager;
use ErrorHeroModule\Command\Preview\ErrorPreviewConsoleCommand;
use ErrorHeroModule\Spec\Fixture\LaminasCacheModule;
use Laminas\Mvc\Application;
use Symfony\Component\Console\Tester\CommandTester;
describe('Integration via ErrorPreviewConsoleCommand with doctrine', function (): void {
given('application', function () {
$application = Application::init([
'modules' => [
'Laminas\Router',
LaminasCacheModule::class,
'DoctrineModule',
'DoctrineORMModule',
'ErrorHeroModule',
],
'module_listener_options' => [
'config_glob_paths' => [
\realpath(__DIR__).'/../Fixture/config/autoload-with-doctrine/error-hero-module.local.php',
\realpath(__DIR__).'/../Fixture/config/module.local.php',
],
],
]);
$serviceManager = $application->getServiceManager();
$entityManager = $serviceManager->get(EntityManager::class);
$stmt = $entityManager->getConnection()->prepare('DELETE FROM log');
$stmt->execute();
return $application;
});
describe('error-preview', function(): void {
it('show error page', function(): void {
/** @var ErrorPreviewConsoleCommand $command */
$command = $this->application->getServiceManager()->get(ErrorPreviewConsoleCommand::class);
$commandTester = new CommandTester($command);
$commandTester->execute([]);
expect($commandTester->getDisplay())->toContain('| We have encountered a problem and we can not fulfill your request');
});
});
describe('error-preview error', function(): void {
it('show error page', function(): void {
/** @var ErrorPreviewConsoleCommand $command */
$command = $this->application->getServiceManager()->get(ErrorPreviewConsoleCommand::class);
$commandTester = new CommandTester($command);
$commandTester->execute([
'type' => 'error',
]);
expect($commandTester->getDisplay())->toContain('| We have encountered a problem and we can not fulfill your request');
});
});
});