-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSmartPhpConfigPrinterTest.php
More file actions
52 lines (43 loc) · 1.75 KB
/
SmartPhpConfigPrinterTest.php
File metadata and controls
52 lines (43 loc) · 1.75 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
<?php
declare(strict_types=1);
namespace Symplify\PhpConfigPrinter\Tests\Printer\SmartPhpConfigPrinter;
use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use Symplify\PhpConfigPrinter\Printer\SmartPhpConfigPrinter;
use Symplify\PhpConfigPrinter\Tests\AbstractTestCase;
use Symplify\PhpConfigPrinter\Tests\Printer\SmartPhpConfigPrinter\Source\ClassWithConstants;
use Symplify\PhpConfigPrinter\Tests\Printer\SmartPhpConfigPrinter\Source\FirstClass;
use Symplify\PhpConfigPrinter\Tests\Printer\SmartPhpConfigPrinter\Source\SecondClass;
final class SmartPhpConfigPrinterTest extends AbstractTestCase
{
private SmartPhpConfigPrinter $smartPhpConfigPrinter;
protected function setUp(): void
{
parent::setUp();
$this->smartPhpConfigPrinter = $this->getService(SmartPhpConfigPrinter::class);
}
/**
* @param array<class-string, mixed[]> $services
*/
#[DataProvider('provideData')]
public function test(array $services, string $expectedContentFilePath): void
{
$printedContent = $this->smartPhpConfigPrinter->printConfiguredServices($services);
$this->assertStringEqualsFile($expectedContentFilePath, $printedContent, $expectedContentFilePath);
}
public static function provideData(): Iterator
{
yield [[
FirstClass::class => [
'some_key' => 'some_value',
],
SecondClass::class => null,
], __DIR__ . '/Fixture/expected_file.php.inc'];
yield [[
ClassWithConstants::class => [
ClassWithConstants::CONFIG_KEY => 'it is constant',
ClassWithConstants::NUMERIC_CONFIG_KEY => 'a lot of numbers',
],
], __DIR__ . '/Fixture/expected_constant_file.php.inc'];
}
}