Skip to content

Commit

Permalink
API phpunit 9 support
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Nov 4, 2021
1 parent 698d6a2 commit 5e43405
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
}
],
"require": {
"php": "^7.3 || ^8.0",
"silverstripe/cms": "^4",
"silverstripe/framework": "^4",
"silverstripe/framework": "^4.10",
"silverstripe/admin": "^1",
"silverstripe/versioned": "^1",
"symfony/yaml": "~3.2"
},
"require-dev": {
"sminnee/phpunit": "^5.7",
"squizlabs/php_codesniffer": "^3"
"phpunit/phpunit": "^9.5"
},
"extra": {
"expose": [
Expand Down
4 changes: 2 additions & 2 deletions tests/WorkflowEmbargoExpiryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WorkflowEmbargoExpiryTest extends SapphireTest
{
protected static $fixture_file = 'WorkflowEmbargoExpiry.yml';

protected function setUp()
protected function setUp(): void
{
// Prevent failure if queuedjobs module isn't installed.
if (!class_exists(AbstractQueuedJob::class)) {
Expand All @@ -43,7 +43,7 @@ protected function setUp()
Config::modify()->set(QueuedJobService::class, 'use_shutdown_function', false);
}

protected function tearDown()
protected function tearDown(): void
{
DBDatetime::clear_mock_now();
parent::tearDown();
Expand Down
2 changes: 1 addition & 1 deletion tests/WorkflowEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function testCreateDefinitionWithEmptyTitle()
$definition = new WorkflowDefinition();
$definition->Title = "";
$definition->write();
$this->assertContains(
$this->assertStringContainsString(
'My Workflow',
$definition->Title,
'Workflow created without title is assigned a default title.'
Expand Down
9 changes: 6 additions & 3 deletions tests/WorkflowImportExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowDefinition;
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowTransition;
use Symbiote\AdvancedWorkflow\Templates\WorkflowTemplate;
use SilverStripe\ORM\ValidationException;

/**
* Tests for workflow import/export logic.
Expand Down Expand Up @@ -109,7 +110,8 @@ public function testFormatWithoutActions()
public function testParseBadYAMLNoHeaderImport()
{
$importer = new WorkflowDefinitionImporter();
$this->setExpectedException('Exception', 'Invalid YAML format.');
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Invalid YAML format.');
$source = <<<'EOD'
SilverStripe\Core\Injector\Injector\Injector:
ExportedWorkflow:
Expand Down Expand Up @@ -143,7 +145,8 @@ class: Symbiote\AdvancedWorkflow\Templates\WorkflowTemplate
public function testParseBadYAMLMalformedImport()
{
$importer = new WorkflowDefinitionImporter();
$this->setExpectedException('SilverStripe\\ORM\\ValidationException', 'Invalid YAML format. Unable to parse.');
$this->expectException(ValidationException::class);
$this->expectExceptionMessage('Invalid YAML format. Unable to parse.');
$source = <<<'EOD'
---
Name: exportedworkflow
Expand Down Expand Up @@ -256,7 +259,7 @@ public function testGetImportedWorkflowsMany()
$imports = $importer->getImportedWorkflows();

$this->assertNotEmpty($imports);
$this->assertInternalType('array', $imports);
$this->assertIsArray($imports);
$this->assertGreaterThan(1, count($imports));
}
}
2 changes: 1 addition & 1 deletion tests/WorkflowInstanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class WorkflowInstanceTest extends SapphireTest
*/
protected $currentMember;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->currentMember = $this->objFromFixture(Member::class, 'ApproverMember01');
Expand Down

0 comments on commit 5e43405

Please sign in to comment.