Skip to content

Commit

Permalink
Merge branch '2'
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Nov 10, 2021
2 parents 5713867 + dc24500 commit 45aaf5e
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 28 deletions.
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
}
],
"require": {
"silverstripe/framework": "^4.4",
"php": "^7.3 || ^8.0",
"silverstripe/framework": "^4.10",
"silverstripe/reports": "^4.4",
"symbiote/silverstripe-queuedjobs": "^4",
"guzzlehttp/guzzle": "^6.3"
},
"require-dev": {
"sminnee/phpunit": "^5.7",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3",
"symfony/thanks": "^1.0"
},
Expand All @@ -36,9 +37,6 @@
}
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
},
"expose": [
"client/dist"
]
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/GridFieldLinkButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public function testCorrectLinkIsContained()
$button = new GridFieldLinkButton('https://addons.silverstripe.org', 'Explore Addons', 'test');
$output = $button->getHTMLFragments(null);

$this->assertContains('https://addons.silverstripe.org', $output['test']);
$this->assertStringContainsString('https://addons.silverstripe.org', $output['test']);
}
}
8 changes: 4 additions & 4 deletions tests/Forms/GridFieldRefreshButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GridFieldRefreshButtonTest extends SapphireTest
{
protected static $fixture_file = 'GridFieldRefreshButtonTest.yml';

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

Expand Down Expand Up @@ -68,7 +68,7 @@ public function testHandleRefreshCreatesJobWhenNoJobIsRunning()
public function testHandleCheckReturnsValidJson()
{
$button = $this->getButton();
$this->assertSame('true', $button->handleCheck());
$this->assertStringContainsString('true', $button->handleCheck());
}

public function testButtonIsDisabledWhenJobIsRunning()
Expand All @@ -79,7 +79,7 @@ public function testButtonIsDisabledWhenJobIsRunning()

$output = $button->getHTMLFragments($gridFieldMock);

$this->assertContains('disabled', $output['test']);
$this->assertStringContainsString('disabled', $output['test']);
}

public function testButtonIsEnabledWhenNoJobIsRunning()
Expand All @@ -92,7 +92,7 @@ public function testButtonIsEnabledWhenNoJobIsRunning()

$output = $button->getHTMLFragments($gridFieldMock);

$this->assertNotContains('disabled', $output['test']);
$this->assertStringNotContainsString('disabled', $output['test']);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Reports/SiteSummaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SiteSummaryTest extends SapphireTest
],
];

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

Expand Down Expand Up @@ -52,6 +52,6 @@ public function testAlertsRenderAtopTheReportField()
$fields = $summaryReport->getCMSFields();
$alertSummary = $fields->fieldByName('AlertSummary');
$this->assertInstanceOf(LiteralField::class, $alertSummary);
$this->assertContains('Sound the alarm!', $alertSummary->getContent());
$this->assertStringContainsString('Sound the alarm!', $alertSummary->getContent());
}
}
4 changes: 2 additions & 2 deletions tests/Tasks/UpdatePackageInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testGetPackageInfo()
/** @var UpdatePackageInfoTask $processor */
$processor = UpdatePackageInfoTask::create();
$output = $processor->getPackageInfo($lockOutput);
$this->assertInternalType('array', $output);
$this->assertIsArray($output);
$this->assertCount(1, $output);
$this->assertContains([
"Name" => "fake/package",
Expand All @@ -74,7 +74,7 @@ public function testGetSupportedPackagesEchosErrors()
$task->getSupportedPackages();
$output = ob_get_clean();

$this->assertContains('A test message', $output);
$this->assertStringContainsString('A test message', $output);
}

public function testPackagesAreAddedCorrectly()
Expand Down
19 changes: 7 additions & 12 deletions tests/Util/ApiLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace BringYourOwnIdeas\Maintenance\Tests\Util;

use RuntimeException;
use BringYourOwnIdeas\Maintenance\Util\ApiLoader;
use GuzzleHttp\Client;
use GuzzleHttp\Handler\MockHandler;
Expand All @@ -12,12 +13,10 @@

class ApiLoaderTest extends SapphireTest
{
/**
* @expectedException RuntimeException
* @expectedExceptionMessage Could not obtain information about module. Error code 404
*/
public function testNon200ErrorCodesAreHandled()
{
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Could not obtain information about module. Error code 404');
$loader = $this->getLoader();
$loader->setGuzzleClient($this->getMockClient(new Response(404)));

Expand All @@ -26,12 +25,10 @@ public function testNon200ErrorCodesAreHandled()
});
}

/**
* @expectedException RuntimeException
* @expectedExceptionMessage Could not obtain information about module. Response is not JSON
*/
public function testNonJsonResponsesAreHandled()
{
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Could not obtain information about module. Response is not JSON');
$loader = $this->getLoader();
$loader->setGuzzleClient($this->getMockClient(new Response(
200,
Expand All @@ -43,12 +40,10 @@ public function testNonJsonResponsesAreHandled()
});
}

/**
* @expectedException RuntimeException
* @expectedExceptionMessage Could not obtain information about module. Response returned unsuccessfully
*/
public function testUnsuccessfulResponsesAreHandled()
{
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Could not obtain information about module. Response returned unsuccessfully');
$loader = $this->getLoader();
$loader->setGuzzleClient($this->getMockClient(new Response(
200,
Expand Down
2 changes: 1 addition & 1 deletion tests/Util/ModuleHealthLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ModuleHealthLoaderTest extends SapphireTest
*/
protected $loader;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/Util/SupportedAddonsLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SupportedAddonsLoaderTest extends SapphireTest
*/
protected $loader;

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

Expand Down

0 comments on commit 45aaf5e

Please sign in to comment.