Skip to content

Commit

Permalink
Merge pull request #273 from OndraM/feature/update-symfony
Browse files Browse the repository at this point in the history
Update to Symfony 5 components
  • Loading branch information
OndraM committed Mar 4, 2021
2 parents 0e91d76 + cf75abf commit 5d5895c
Show file tree
Hide file tree
Showing 22 changed files with 91 additions and 91 deletions.
36 changes: 18 additions & 18 deletions composer.json
Expand Up @@ -28,35 +28,35 @@
"ext-libxml": "*",
"ext-zip": "*",
"beberlei/assert": "^3.0",
"clue/graph": "~0.9.0",
"clue/graph": "^0.9.2",
"doctrine/inflector": "^2.0.3",
"florianwolters/component-util-singleton": "0.3.2",
"graphp/algorithms": "^0.8.1",
"florianwolters/component-util-singleton": "^0.3.2",
"graphp/algorithms": "^0.8.2",
"ondram/ci-detector": "^4.0",
"php-webdriver/webdriver": "^1.8.1",
"php-webdriver/webdriver": "^1.10.0",
"phpdocumentor/reflection-docblock": "^5.2",
"phpunit/phpunit": "^7.5.20",
"roave/better-reflection": "^4.3",
"symfony/console": "^4.0",
"symfony/event-dispatcher": "^4.0",
"symfony/filesystem": "^4.0",
"symfony/finder": "^4.0",
"symfony/options-resolver": "^4.0",
"symfony/console": "^5.2",
"symfony/event-dispatcher": "^5.2",
"symfony/filesystem": "^5.2",
"symfony/finder": "^5.2",
"symfony/options-resolver": "^5.2",
"symfony/polyfill-mbstring": "^1.12",
"symfony/process": "^4.0.3",
"symfony/stopwatch": "^4.0",
"symfony/yaml": "^4.0"
"symfony/process": "^5.2",
"symfony/stopwatch": "^5.2",
"symfony/yaml": "^5.2"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.11",
"ergebnis/composer-normalize": "^2.13",
"lmc/coding-standard": "^3.0.0",
"php-mock/php-mock-phpunit": "^2.6.0",
"php-parallel-lint/php-parallel-lint": "^1.2.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.11",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpunit/php-code-coverage": "^6.0",
"symfony/var-dumper": "^4.0"
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^0.12.80",
"phpstan/phpstan-phpunit": "^0.12.17",
"phpunit/php-code-coverage": "^6.1",
"symfony/var-dumper": "^5.2"
},
"suggest": {
"ext-posix": "For colored output",
Expand Down
2 changes: 1 addition & 1 deletion src-tests/Console/Command/CommandTest.php
Expand Up @@ -41,7 +41,7 @@ public function testShouldDispatchPreInitializeEvent(): void

$dispatcherMock->expects($this->at(0))
->method('dispatch')
->with($this->equalTo(CommandEvents::PRE_INITIALIZE), $this->isInstanceOf(ExtendedConsoleEvent::class));
->with($this->isInstanceOf(ExtendedConsoleEvent::class), $this->equalTo(CommandEvents::PRE_INITIALIZE));

$application = new Application();
$application->add(new DummyCommand($dispatcherMock, 'command'));
Expand Down
4 changes: 2 additions & 2 deletions src-tests/Console/Command/InstallCommandTest.php
Expand Up @@ -245,11 +245,11 @@ public function testShouldDispatchEventsOnExecute(): void

$dispatcherMock->expects($this->at(0))
->method('dispatch')
->with($this->equalTo(CommandEvents::CONFIGURE), $this->isInstanceOf(BasicConsoleEvent::class));
->with($this->isInstanceOf(BasicConsoleEvent::class), $this->equalTo(CommandEvents::CONFIGURE));

$dispatcherMock->expects($this->at(1))
->method('dispatch')
->with($this->equalTo(CommandEvents::PRE_INITIALIZE), $this->isInstanceOf(ExtendedConsoleEvent::class));
->with($this->isInstanceOf(ExtendedConsoleEvent::class), $this->equalTo(CommandEvents::PRE_INITIALIZE));

$application = new Application();
$application->add(new InstallCommand($dispatcherMock));
Expand Down
6 changes: 3 additions & 3 deletions src-tests/Console/Command/RunCommandTest.php
Expand Up @@ -291,15 +291,15 @@ public function testShouldDispatchEventsOnExecute(): void

$dispatcherMock->expects($this->at(0))
->method('dispatch')
->with($this->equalTo(CommandEvents::CONFIGURE), $this->isInstanceOf(BasicConsoleEvent::class));
->with($this->isInstanceOf(BasicConsoleEvent::class), $this->equalTo(CommandEvents::CONFIGURE));

$dispatcherMock->expects($this->at(1))
->method('dispatch')
->with($this->equalTo(CommandEvents::PRE_INITIALIZE), $this->isInstanceOf(ExtendedConsoleEvent::class));
->with($this->isInstanceOf(ExtendedConsoleEvent::class), $this->equalTo(CommandEvents::PRE_INITIALIZE));

$dispatcherMock->expects($this->at(2))
->method('dispatch')
->with($this->equalTo(CommandEvents::RUN_TESTS_INIT), $this->isInstanceOf(ExtendedConsoleEvent::class));
->with($this->isInstanceOf(ExtendedConsoleEvent::class), $this->equalTo(CommandEvents::RUN_TESTS_INIT));

$application = new Application();
$application->add(new RunCommand($dispatcherMock));
Expand Down
4 changes: 2 additions & 2 deletions src-tests/Process/ExecutionLoopTest.php
Expand Up @@ -36,8 +36,8 @@ public function shouldExecuteEmptyProcessSet(): void
/** @test */
public function shouldDequeueProcessesWithoutDelayOnStartup(): void
{
$noDelayTest = new ProcessWrapper(new Process('echo NoDelay'), 'NoDelay');
$delayedTest = new ProcessWrapper(new Process('echo Delayed'), 'Delayed');
$noDelayTest = new ProcessWrapper(new Process(['echo', 'NoDelay']), 'NoDelay');
$delayedTest = new ProcessWrapper(new Process(['echo', 'Delayed']), 'Delayed');
$delayedTest->setDelay('NoDelay', 0.001);

$processSet = new ProcessSet();
Expand Down
2 changes: 1 addition & 1 deletion src-tests/Process/ProcessSetCreatorTest.php
Expand Up @@ -316,7 +316,7 @@ public function testShouldDispatchProcessEvent(): void
{
$this->dispatcherMock->expects($this->at(0))
->method('dispatch')
->with($this->equalTo(CommandEvents::RUN_TESTS_PROCESS), $this->isInstanceOf(RunTestsProcessEvent::class));
->with($this->isInstanceOf(RunTestsProcessEvent::class), $this->equalTo(CommandEvents::RUN_TESTS_PROCESS));

$this->creator->createFromFiles($this->findDummyTests(), [], ['bar', 'foo']);
}
Expand Down
72 changes: 36 additions & 36 deletions src-tests/Process/ProcessSetTest.php
Expand Up @@ -24,27 +24,27 @@ protected function setUp(): void
public function testShouldBeCountable(): void
{
$this->assertCount(0, $this->set);
$this->set->add(new ProcessWrapper(new Process(''), 'Foo'));
$this->set->add(new ProcessWrapper(new Process([]), 'Foo'));
$this->assertCount(1, $this->set);
$this->set->add(new ProcessWrapper(new Process(''), 'Bar'));
$this->set->add(new ProcessWrapper(new Process(''), 'Baz'));
$this->set->add(new ProcessWrapper(new Process([]), 'Bar'));
$this->set->add(new ProcessWrapper(new Process([]), 'Baz'));
$this->assertCount(3, $this->set);
}

public function testShouldFailWhenAddingTestWithNonUniqueName(): void
{
$this->set->add(new ProcessWrapper(new Process(''), 'Foo\Bar'));
$this->set->add(new ProcessWrapper(new Process([]), 'Foo\Bar'));

$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Testcase with name "Foo\Bar" was already added');

$this->set->add(new ProcessWrapper(new Process(''), 'Foo\Bar'));
$this->set->add(new ProcessWrapper(new Process([]), 'Foo\Bar'));
}

public function testShouldHasNewlyAddedProcessInQueuedState(): void
{
$this->set->add(new ProcessWrapper(new Process(''), 'Foo'));
$this->set->add(new ProcessWrapper(new Process(''), 'Bar'));
$this->set->add(new ProcessWrapper(new Process([]), 'Foo'));
$this->set->add(new ProcessWrapper(new Process([]), 'Bar'));

$this->assertCount(2, $this->set->get(ProcessWrapper::PROCESS_STATUS_QUEUED));
$this->assertCount(0, $this->set->get(ProcessWrapper::PROCESS_STATUS_DONE));
Expand All @@ -53,8 +53,8 @@ public function testShouldHasNewlyAddedProcessInQueuedState(): void

public function testShouldAddAndGetWrappedProcesses(): void
{
$processFoo = new ProcessWrapper(new Process(''), 'Foo');
$processBaz = new ProcessWrapper(new Process(''), 'Baz');
$processFoo = new ProcessWrapper(new Process([]), 'Foo');
$processBaz = new ProcessWrapper(new Process([]), 'Baz');
$this->set->add($processFoo);
$this->set->add($processBaz);

Expand All @@ -66,9 +66,9 @@ public function testShouldAddAndGetWrappedProcesses(): void

public function testShouldRetrieveProcessesByStatus(): void
{
$doneTest1 = new ProcessWrapper(new Process(''), 'DoneTest1');
$doneTest2 = new ProcessWrapper(new Process(''), 'DoneTest2');
$preparedTest = new ProcessWrapper(new Process(''), 'PreparedTest');
$doneTest1 = new ProcessWrapper(new Process([]), 'DoneTest1');
$doneTest2 = new ProcessWrapper(new Process([]), 'DoneTest2');
$preparedTest = new ProcessWrapper(new Process([]), 'PreparedTest');
$this->set->add($doneTest1);
$this->set->add($doneTest2);
$this->set->add($preparedTest);
Expand Down Expand Up @@ -113,7 +113,7 @@ public function testShouldPublishProcessWhenAdded(): void
);

$set = new ProcessSet($publisherMock);
$set->add(new ProcessWrapper(new Process(''), 'FooClassName'));
$set->add(new ProcessWrapper(new Process([]), 'FooClassName'));
}

public function testShouldAllowToDefinePublisherUsingSetter(): void
Expand All @@ -133,18 +133,18 @@ public function testShouldAllowToDefinePublisherUsingSetter(): void
);

$set->setPublisher($publisherMock);
$set->add(new ProcessWrapper(new Process(''), 'FooClassName'));
$set->add(new ProcessWrapper(new Process([]), 'FooClassName'));
}

public function testShouldCountStatusesOfWrappedProcesses(): void
{
$doneTest1 = new ProcessWrapper(new Process(''), 'DoneTest1');
$doneTest1 = new ProcessWrapper(new Process([]), 'DoneTest1');
$doneTest1->setStatus(ProcessWrapper::PROCESS_STATUS_DONE);
$doneTest2 = new ProcessWrapper(new Process(''), 'DoneTest2');
$doneTest2 = new ProcessWrapper(new Process([]), 'DoneTest2');
$doneTest2->setStatus(ProcessWrapper::PROCESS_STATUS_DONE);
$queuedTest = new ProcessWrapper(new Process(''), 'QueuedTest');
$queuedTest = new ProcessWrapper(new Process([]), 'QueuedTest');
$queuedTest->setStatus(ProcessWrapper::PROCESS_STATUS_QUEUED);
$preparedTest = new ProcessWrapper(new Process(''), 'PreparedTest');
$preparedTest = new ProcessWrapper(new Process([]), 'PreparedTest');
$preparedTest->setStatus(ProcessWrapper::PROCESS_STATUS_PREPARED);

$this->set->add($doneTest1);
Expand Down Expand Up @@ -198,7 +198,7 @@ public function testShouldCountResultsOfDoneProcesses(): void

public function testShouldFailBuildingTreeIfTestHasDependencyOnNotExistingTest(): void
{
$process = new ProcessWrapper(new Process(''), 'Foo');
$process = new ProcessWrapper(new Process([]), 'Foo');
$process->setDelay('NotExisting', 5);

$this->set->add($process);
Expand All @@ -218,9 +218,9 @@ public function testShouldFailBuildingTreeIfCycleDetected(): void
A <--> B
*/

$processA = new ProcessWrapper(new Process(''), 'A');
$processA = new ProcessWrapper(new Process([]), 'A');
$processA->setDelay('B', 1);
$processB = new ProcessWrapper(new Process(''), 'B');
$processB = new ProcessWrapper(new Process([]), 'B');
$processB->setDelay('A', 1);

$this->set->add($processA);
Expand All @@ -242,12 +242,12 @@ public function testShouldBuildGraphTreeFromProcessDependencies(): void

// Order in which dependencies are added before buildTree() is called is not important,
// so add leafs to the tree first.
$processC = new ProcessWrapper(new Process(''), 'C');
$processC = new ProcessWrapper(new Process([]), 'C');
$processC->setDelay('B', 3);
$processD = new ProcessWrapper(new Process(''), 'D');
$processD = new ProcessWrapper(new Process([]), 'D');
$processD->setDelay('B', 5);
$processA = new ProcessWrapper(new Process(''), 'A');
$processB = new ProcessWrapper(new Process(''), 'B');
$processA = new ProcessWrapper(new Process([]), 'A');
$processB = new ProcessWrapper(new Process([]), 'B');

$this->set->add($processC);
$this->set->add($processD);
Expand Down Expand Up @@ -291,11 +291,11 @@ public function testShouldChangeOrderOfProcessesByGivenStrategy(): void
// 3 / \ 5
// C D

$processA = new ProcessWrapper(new Process(''), 'A');
$processB = new ProcessWrapper(new Process(''), 'B');
$processC = new ProcessWrapper(new Process(''), 'C');
$processA = new ProcessWrapper(new Process([]), 'A');
$processB = new ProcessWrapper(new Process([]), 'B');
$processC = new ProcessWrapper(new Process([]), 'C');
$processC->setDelay('B', 3);
$processD = new ProcessWrapper(new Process(''), 'D');
$processD = new ProcessWrapper(new Process([]), 'D');
$processD->setDelay('B', 5);

$this->set->add($processA);
Expand Down Expand Up @@ -324,13 +324,13 @@ public function testShouldFailDependantsOfGivenProcess(): void
// | 0 (zero delay is also allowed)
// E

$processA = new ProcessWrapper(new Process(''), 'A');
$processB = new ProcessWrapper(new Process(''), 'B');
$processC = new ProcessWrapper(new Process(''), 'C');
$processA = new ProcessWrapper(new Process([]), 'A');
$processB = new ProcessWrapper(new Process([]), 'B');
$processC = new ProcessWrapper(new Process([]), 'C');
$processC->setDelay('B', 3);
$processD = new ProcessWrapper(new Process(''), 'D');
$processD = new ProcessWrapper(new Process([]), 'D');
$processD->setDelay('B', 5);
$processE = new ProcessWrapper(new Process(''), 'E');
$processE = new ProcessWrapper(new Process([]), 'E');
$processE->setDelay('D', 0);

$this->set->add($processA);
Expand Down Expand Up @@ -371,8 +371,8 @@ public function testShouldFailDependantsOfGivenProcess(): void

public function testShouldFailWhenFailingDependantsButTheTreeWasNotYetBuilt(): void
{
$processA = new ProcessWrapper(new Process(''), 'A');
$processB = new ProcessWrapper(new Process(''), 'B');
$processA = new ProcessWrapper(new Process([]), 'A');
$processB = new ProcessWrapper(new Process([]), 'B');
$processB->setDelay('A', 3);

$this->set->add($processA);
Expand Down
16 changes: 8 additions & 8 deletions src-tests/Process/ProcessWrapperTest.php
Expand Up @@ -13,7 +13,7 @@ class ProcessWrapperTest extends TestCase
{
public function testShouldWrapGivenProcess(): void
{
$process = new Process('');
$process = new Process([]);

$wrapper = new ProcessWrapper($process, 'ClassName');

Expand All @@ -29,7 +29,7 @@ public function testShouldWrapGivenProcess(): void
*/
public function testShouldSetDelayForTheProcess(float $delay): void
{
$wrapper = new ProcessWrapper(new Process(''), 'Foo');
$wrapper = new ProcessWrapper(new Process([]), 'Foo');
$wrapper->setDelay('Bar', $delay);

$this->assertTrue($wrapper->isDelayed());
Expand All @@ -56,7 +56,7 @@ public function testShouldAcceptOnlyNumbersGreaterThanOrEqualToZeroAsDelay(
$delay,
string $expectedExceptionMessage
): void {
$wrapper = new ProcessWrapper(new Process(''), 'Foo');
$wrapper = new ProcessWrapper(new Process([]), 'Foo');

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage($expectedExceptionMessage);
Expand Down Expand Up @@ -89,7 +89,7 @@ public function provideInvalidDelay(): array

public function testShouldFailIfDependencyWasDefinedButWithoutDelay(): void
{
$wrapper = new ProcessWrapper(new Process(''), 'Foo');
$wrapper = new ProcessWrapper(new Process([]), 'Foo');

$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage(
Expand Down Expand Up @@ -139,7 +139,7 @@ public function provideProcessResult(): array

public function testShouldNotStoreResultAndTimeOfWhenSettingOtherThanDoneStatus(): void
{
$preparedTest = new ProcessWrapper(new Process(''), 'PreparedTest');
$preparedTest = new ProcessWrapper(new Process([]), 'PreparedTest');
$preparedTest->setStatus(ProcessWrapper::PROCESS_STATUS_PREPARED);

$this->assertNull($preparedTest->getResult());
Expand All @@ -148,7 +148,7 @@ public function testShouldNotStoreResultAndTimeOfWhenSettingOtherThanDoneStatus(

public function testShouldFailIfWrongProcessStatusGiven(): void
{
$wrapper = new ProcessWrapper(new Process(''), 'Foo');
$wrapper = new ProcessWrapper(new Process([]), 'Foo');

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(
Expand Down Expand Up @@ -182,7 +182,7 @@ public function testShouldPublishProcessStatusWhenInitializedAndWhenStatusWasSet
$this->identicalTo(null)
);

$wrapper = new ProcessWrapper(new Process(''), 'FooClassName', $publisherMock);
$wrapper = new ProcessWrapper(new Process([]), 'FooClassName', $publisherMock);

$wrapper->setStatus(ProcessWrapper::PROCESS_STATUS_DONE);
}
Expand All @@ -195,7 +195,7 @@ public function testShouldReturnErrorMessageIfProcessTimeoutIsDetected(): void
->method('checkTimeout')
->willThrowException(
new ProcessTimedOutException(
new Process('', null, null, null, 33),
new Process([], null, null, null, 33),
ProcessTimedOutException::TYPE_GENERAL
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Legacy.php
Expand Up @@ -116,7 +116,7 @@ protected function getLegacyName(string $type): string
$name = preg_replace('/Phase\d/', '', $name); // remove 'PhaseX' from the name
$name = Strings::toFilename($name);

if ($type == self::LEGACY_TYPE_TEST) {
if ($type === self::LEGACY_TYPE_TEST) {
$name .= '#' . Strings::toFilename($this->tc->getName(false));
}

Expand Down
2 changes: 1 addition & 1 deletion src/ConfigProvider.php
Expand Up @@ -24,7 +24,7 @@ class ConfigProvider
use SingletonTrait;

/** @var array Configuration options and theirs values */
private $config = null;
private $config;
/** @var array Array of custom configuration options that should be added to the default ones */
private $customConfigurationOptions = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/CleanCommand.php
Expand Up @@ -52,7 +52,7 @@ protected function configure(): void
STEWARD_BASE_DIR . DIRECTORY_SEPARATOR . 'logs'
);

$this->getDispatcher()->dispatch(CommandEvents::CONFIGURE, new BasicConsoleEvent($this));
$this->getDispatcher()->dispatch(new BasicConsoleEvent($this), CommandEvents::CONFIGURE);
}

protected function resolveConfiguration(InputInterface $input): array
Expand Down

0 comments on commit 5d5895c

Please sign in to comment.