Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API phpunit 9 support #57

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
"license": "BSD-3-Clause",
"minimum-stability": "dev",
"require": {
"php": "^7.3 || ^8.0",
"league/csv": "^8 || ^9",
"silverstripe/framework": "^4",
"silverstripe/framework": "^4.10",
"symbiote/silverstripe-queuedjobs": "^4"
},
"require-dev": {
"sminnee/phpunit": "^5.7",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.0"
},
"extra": {
Expand Down
8 changes: 5 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
<testsuites>
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
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