Skip to content

Commit

Permalink
Update tests - do not uses themes, width/height assertion update
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesDPC committed Aug 17, 2022
1 parent fa1dc8a commit b9a9c90
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/QuickGalleryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SilverStripe\Assets\File;
use SilverStripe\Assets\Folder;
use SilverStripe\Assets\Image;
use SilverStripe\View\SSViewer;

/**
* Unit test to vverify quick gallery setup
Expand Down Expand Up @@ -41,6 +42,8 @@ public function tearDown() : void

public function testGallery() {

SSViewer::set_themes(['$public', '$default']);

Config::inst()->update(ElementQuickGallery::class, 'default_thumb_width', 190);
Config::inst()->update(ElementQuickGallery::class, 'default_thumb_height', 160);

Expand All @@ -53,8 +56,11 @@ public function testGallery() {
$gallery->write();

// assert that defaults kick in when incorrect values are provided
$this->assertEquals(190, $gallery->Width, "Gallery width should be 190");
$this->assertEquals(160, $gallery->Height, "Gallery height should be 160");
$this->assertEquals(0, $gallery->Width, "Gallery width should be 0");
$this->assertEquals(0, $gallery->Height, "Gallery height should be 0");

$this->assertEquals(190, $gallery->getThumbWidth(), "Gallery width should be 190");
$this->assertEquals(160, $gallery->getThumbHeight(), "Gallery height should be 160");

$gallery->Width = 400;
$gallery->write();
Expand Down

0 comments on commit b9a9c90

Please sign in to comment.