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 Oct 13, 2021
1 parent 4ccabdf commit b5623bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"symbiote/silverstripe-queuedjobs": "^4"
},
"require-dev": {
"sminnee/phpunit": "^5.7",
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "^3.0"
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/GenerateCSVJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ protected function outputRows(GridField $gridField, $columns, $start, $count)
}
}

public function setup()
public function setUp()
{
parent::setup();
$gridField = $this->getGridField();
Expand Down
16 changes: 8 additions & 8 deletions tests/GenerateCSVJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class GenerateCSVJobTest extends SapphireTest

protected static $extra_controllers = [GenerateCSVJobTestController::class];

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

Expand All @@ -32,7 +32,7 @@ protected function setUp()

protected $paths = [];

protected function tearDown()
protected function tearDown(): void
{
foreach ($this->paths as $path) {
Filesystem::removeFolder(dirname($path));
Expand All @@ -57,7 +57,7 @@ public function testGenerateExport()
$this->paths[] = $path; // Mark for cleanup later

// Test that the job runs
$this->assertFileNotExists($path);
$this->assertFileDoesNotExist($path);
$job->setup();
$job->process();
$job->afterComplete();
Expand All @@ -72,8 +72,8 @@ public function testGenerateExport()
];
$actual = file_get_contents($path);
// Note: strtolower() is for case insensitive comparison, since field label casing changed in SS 4.3
$this->assertContains('title,content,"publish on"', strtolower($actual));
$this->assertContains(implode("\r\n", $expected), $actual);
$this->assertStringContainsString('title,content,"publish on"', strtolower($actual));
$this->assertStringContainsString(implode("\r\n", $expected), $actual);
}

public function testGenerateExportOverMultipleSteps()
Expand All @@ -96,7 +96,7 @@ public function testGenerateExportOverMultipleSteps()
$this->paths[] = $path; // Mark for cleanup later

// Test that the job runs
$this->assertFileNotExists($path);
$this->assertFileDoesNotExist($path);
$count = 0;
while (!$job->jobFinished()) {
++$count;
Expand All @@ -120,8 +120,8 @@ public function testGenerateExportOverMultipleSteps()
];
$actual = file_get_contents($path);
// Note: strtolower() is for case insensitive comparison, since field label casing changed in SS 4.3
$this->assertContains('title,content,"publish on"', strtolower($actual));
$this->assertContains(implode("\r\n", $expected), $actual);
$this->assertStringContainsString('title,content,"publish on"', strtolower($actual));
$this->assertStringContainsString(implode("\r\n", $expected), $actual);
}

/**
Expand Down

0 comments on commit b5623bb

Please sign in to comment.