Skip to content

Commit

Permalink
fix phpunit (8) warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Stark committed May 4, 2021
1 parent f499f0f commit 3443e61
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C:37:"PHPUnit\Runner\DefaultTestResultCache":563:{a:2:{s:7:"defects";a:2:{s:55:"QueueCommandTest::test_getPreparedCommand_with_defaults";i:6;s:65:"QueueCommandTest::test_getPreparedCommand_alternative_script_args";i:6;}s:5:"times";a:5:{s:65:"BackgroundProcessRunTest::test_start_default_dummy_script_success";d:0.267;s:55:"QueueCommandTest::test_getPreparedCommand_with_defaults";d:0;s:58:"QueueCommandTest::test_getPreparedCommand_wrong_PHP_BINARY";d:0.004;s:64:"QueueCommandTest::test_getPreparedCommand_alternative_decoration";d:0;s:65:"QueueCommandTest::test_getPreparedCommand_alternative_script_args";d:0;}}}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## [2.3.0] - 2021-05-04
### Changed
- Added dependency `treeware/plant`
- Housekeeping `composer.json`


## [2.2.0] - 2021-02-05
### Changed
- Added support for `symfony/process:^5.0`
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"require": {
"php": ">=7.1",
"craftcms/cms": "^3.0.0",
"symfony/process": "^4.2|^5.0"
"symfony/process": "^4.2|^5.0",
"treeware/plant": "^0.1.0"
},
"autoload": {
"psr-4": {
Expand All @@ -39,7 +40,7 @@
"changelogUrl": "https://raw.githubusercontent.com/ostark/craft-async-queue/master/CHANGELOG.md"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
"phpunit/phpunit": "^7.0|^8.0",
"vimeo/psalm": "^4.4"
},
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions tests/BackgroundProcessRunTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ class BackgroundProcessRunTest extends TestCase
{


public function setUp()
public function setUp(): void
{
parent::setUp();
}

public function tearDown()
public function tearDown(): void
{
parent::tearDown();
unlink(TEST_FILE);
Expand All @@ -26,9 +26,9 @@ public function tearDown()
*/
public function test_start_default_dummy_script_success()
{
$command = new \ostark\AsyncQueue\QueueCommand('craft.php', 'queue/run');
$command = new \ostark\AsyncQueue\QueueCommand('craft.php', 'queue/run');
$bgProcess = new BackgroundProcess($command);
$process = $bgProcess->start();
$process = $bgProcess->start();

$this->assertEquals(0, $process->getExitCode());
$this->assertTrue($process->isSuccessful());
Expand Down
24 changes: 12 additions & 12 deletions tests/QueueCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class QueueCommandTest extends TestCase
{

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand All @@ -22,12 +22,12 @@ public function setUp()
*/
public function test_getPreparedCommand_with_defaults()
{
$command = new \ostark\AsyncQueue\QueueCommand();
$command = new \ostark\AsyncQueue\QueueCommand();
$prepared = $command->getPreparedCommand();

$this->assertContains('php', $prepared);
$this->assertContains(\ostark\AsyncQueue\QueueCommand::DEFAULT_SCRIPT, $prepared);
$this->assertContains(\ostark\AsyncQueue\QueueCommand::DEFAULT_ARGS, $prepared);
$this->assertStringContainsString('php', $prepared);
$this->assertStringContainsString(\ostark\AsyncQueue\QueueCommand::DEFAULT_SCRIPT, $prepared);
$this->assertStringContainsString(\ostark\AsyncQueue\QueueCommand::DEFAULT_ARGS, $prepared);
}

/**
Expand All @@ -52,13 +52,13 @@ public function test_getPreparedCommand_alternative_decoration()
\yii\base\Event::on(
\ostark\AsyncQueue\QueueCommand::class,
\ostark\AsyncQueue\QueueCommand::EVENT_PREPARE_COMMAND,
function(\ostark\AsyncQueue\Events\QueueCommandEvent $event) {
function (\ostark\AsyncQueue\Events\QueueCommandEvent $event) {
$event->useDefaultDecoration = false;
$event->commandLine = "BEFORE {$event->commandLine} AFTER";
$event->commandLine = "BEFORE {$event->commandLine} AFTER";
}
);

$command = new \ostark\AsyncQueue\QueueCommand();
$command = new \ostark\AsyncQueue\QueueCommand();
$prepared = $command->getPreparedCommand();

$this->assertStringStartsWith('BEFORE', $prepared);
Expand All @@ -78,13 +78,13 @@ function(\ostark\AsyncQueue\Events\QueueCommandEvent $event) {
public function test_getPreparedCommand_alternative_script_args()
{
$script = 'foo.php';
$args = '--bar';
$args = '--bar';

$command = new \ostark\AsyncQueue\QueueCommand($script, $args);
$command = new \ostark\AsyncQueue\QueueCommand($script, $args);
$prepared = $command->getPreparedCommand();

$this->assertContains($script, $prepared);
$this->assertContains($args, $prepared);
$this->assertStringContainsString($script, $prepared);
$this->assertStringContainsString($args, $prepared);
}

}

0 comments on commit 3443e61

Please sign in to comment.