Merge pull request #500 from dhensby/pulls/test-fixes

Fix regression in tests
This commit is contained in:
Robbie Averill 2018-01-11 07:40:57 +13:00 committed by GitHub
commit 649536521d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 18 deletions

View File

@ -2,12 +2,12 @@
namespace SilverStripe\Blog\Widgets;
if (!class_exists('\\SilverStripe\\Widgets\\Model\\Widget')) {
use SilverStripe\Widgets\Model\WidgetController;
if (!class_exists(WidgetController::class)) {
return;
}
use SilverStripe\Widgets\Model\WidgetController;
class BlogArchiveWidgetController extends WidgetController
{

View File

@ -2,12 +2,12 @@
namespace SilverStripe\Blog\Widgets;
if (!class_exists('\\SilverStripe\\Widgets\\Model\\Widget')) {
use SilverStripe\Widgets\Model\WidgetController;
if (!class_exists(WidgetController::class)) {
return;
}
use SilverStripe\Widgets\Model\WidgetController;
class BlogCategoriesWidgetController extends WidgetController
{

View File

@ -2,12 +2,12 @@
namespace SilverStripe\Blog\Widgets;
if (!class_exists('\\SilverStripe\\Widgets\\Model\\Widget')) {
use SilverStripe\Widgets\Model\WidgetController;
if (!class_exists(WidgetController::class)) {
return;
}
use SilverStripe\Widgets\Model\WidgetController;
class BlogRecentPostsWidgetController extends WidgetController
{

View File

@ -2,12 +2,12 @@
namespace SilverStripe\Blog\Widgets;
if (!class_exists('\\SilverStripe\\Widgets\\Model\\Widget')) {
use SilverStripe\Widgets\Model\WidgetController;
if (!class_exists(WidgetController::class)) {
return;
}
use SilverStripe\Widgets\Model\WidgetController;
class BlogTagsCloudWidgetController extends WidgetController
{
}

View File

@ -2,12 +2,12 @@
namespace SilverStripe\Blog\Widgets;
if (!class_exists('\\SilverStripe\\Widgets\\Model\\Widget')) {
use SilverStripe\Widgets\Model\WidgetController;
if (!class_exists(WidgetController::class)) {
return;
}
use SilverStripe\Widgets\Model\WidgetController;
class BlogTagsWidgetController extends WidgetController
{

View File

@ -42,7 +42,7 @@ class BlogArchiveWidgetTest extends SapphireTest
$this->assertInstanceOf(SS_List::class, $archive);
$this->assertCount(3, $archive);
$this->assertDOSContains([
$this->assertListContains([
['Title' => 'August 2017'],
['Title' => 'September 2017'],
['Title' => 'May 2015'],
@ -54,13 +54,14 @@ class BlogArchiveWidgetTest extends SapphireTest
$original = Versioned::get_stage();
$this->objFromFixture(BlogPost::class, 'post-b')->publishRecursive();
$this->objFromFixture(BlogArchiveWidget::class, 'archive-monthly')->publishRecursive();
Versioned::set_stage(Versioned::LIVE);
$widget = $this->objFromFixture(BlogArchiveWidget::class, 'archive-monthly');
$archive = $widget->getArchive();
$this->assertCount(1, $archive);
$this->assertDOSContains([
$this->assertListContains([
['Title' => 'August 2017'],
], $archive);
@ -76,7 +77,7 @@ class BlogArchiveWidgetTest extends SapphireTest
$this->assertInstanceOf(SS_List::class, $archive);
$this->assertCount(2, $archive);
$this->assertDOSContains([
$this->assertListContains([
['Title' => '2017'],
['Title' => '2015'],
], $archive);