Skip to content

Commit d6eee41

Browse files
committed
Updated test for ShutdownFunctionService
1 parent e3423b5 commit d6eee41

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"autoload-dev": {
1212
"psr-4": {
13-
"Test\\": "test/"
13+
"DynamicDeadCodeDetector\\": "test/"
1414
}
1515
},
1616
"authors": [

test/Service/ShutdownFunctionServiceTest.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
<?php
22

3-
namespace Test\Service;
3+
namespace DynamicDeadCodeDetector\Service;
44

55
use DynamicDeadCodeDetector\OutputHandler\OutputHandlerInterface;
6-
use DynamicDeadCodeDetector\Service\ShutdownFunctionService;
76
use PHPUnit\Framework\TestCase;
87

98
class ShutdownFunctionServiceTest extends TestCase
109
{
10+
protected function setUp(): void
11+
{
12+
require_once 'get_declared_classes.php';
13+
}
14+
1115
public function test_shutdownHandler_calls_save_on_outputHandler()
1216
{
1317
$outputHandler = $this->createMock(OutputHandlerInterface::class);
1418
$outputHandler->expects($this->once())
15-
->method('save');
19+
->method('save')
20+
->with(['Foo', 'Bar']);
1621

1722
$shutdownFunctionService = new ShutdownFunctionService($outputHandler, false);
1823
$shutdownFunctionService->shutdownHandler();

test/Service/get_declared_classes.php

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace DynamicDeadCodeDetector\Service;
4+
5+
function get_declared_classes()
6+
{
7+
return ['Foo', 'Bar'];
8+
}

0 commit comments

Comments
 (0)