Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 0c69f05

Browse files
author
Andrey Helldar
committed
Added configuration override for testing under Symfony
1 parent f394ede commit 0c69f05

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

src/Frameworks/Symfony/Console/Sync.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Symfony\Component\Console\Input\InputInterface;
1010
use Symfony\Component\Console\Output\OutputInterface;
1111

12-
final class Sync extends Command
12+
class Sync extends Command
1313
{
1414
/** @var \Symfony\Component\Console\Input\InputInterface */
1515
protected $input;
@@ -39,6 +39,11 @@ protected function configure()
3939
->addOption('path', null, InputArgument::OPTIONAL, 'Gets the path to scan for files');
4040
}
4141

42+
protected function syncerConfig(): array
43+
{
44+
return [];
45+
}
46+
4247
protected function execute(InputInterface $input, OutputInterface $output): int
4348
{
4449
$this->input = $input;

tests/Cases/SymfonyTestCase.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ abstract class SymfonyTestCase extends TestCase
2525
/** @var \Symfony\Bundle\FrameworkBundle\Console\Application */
2626
protected $application;
2727

28+
abstract protected function getSyncConfig(): ?array;
29+
2830
protected function setUp(): void
2931
{
3032
$this->mockContainer();
@@ -76,7 +78,7 @@ protected function composerConfig(): Config
7678

7779
protected function getSyncer(): Syncer
7880
{
79-
return Syncer::make();
81+
return Syncer::make($this->getSyncConfig());
8082
}
8183

8284
protected function getCommand(): Sync

tests/Symfony/ConfigurableTest.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public function testCustomPathFailed()
2323
{
2424
$this->expectException(DirectoryNotFoundException::class);
2525

26-
$this->call('env:sync', ['--path' => base_path('foo')]);
26+
$this->call('env:sync', ['--path' => '/foo']);
27+
}
28+
29+
protected function getSyncConfig(): ?array
30+
{
31+
return $this->config();
2732
}
2833
}

tests/Symfony/MainTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ public function testCustomPathFailed()
2626

2727
$this->call('env:sync', ['--path' => '/foo']);
2828
}
29+
30+
protected function getSyncConfig(): ?array
31+
{
32+
return null;
33+
}
2934
}

0 commit comments

Comments
 (0)