Skip to content

Commit

Permalink
Improve reliability of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers committed Jul 26, 2024
1 parent a797a2f commit c699d38
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace System\Tests\Classes;
namespace Cms\Tests\Classes;

use System\Tests\Bootstrap\PluginTestCase;
use Cms\Classes\AutoDatasource;
Expand Down
16 changes: 16 additions & 0 deletions modules/system/tests/classes/ImageResizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public function tearDown(): void
*/
public function testConfiguration()
{
if (!in_array('Cms', Config::get('cms.loadModules', []))) {
$this->markTestSkipped('The CMS module is not active.');
}

// Resize with default options
$imageResizer = new ImageResizer(
(new CmsController())->themeUrl('assets/images/winter.png'),
Expand Down Expand Up @@ -178,6 +182,10 @@ public function testConfiguration()
*/
public function testURLSources()
{
if (!in_array('Cms', Config::get('cms.loadModules', []))) {
$this->markTestSkipped('The CMS module is not active.');
}

// Theme URL (absolute URL)
$this->setUpStorage();
$this->copyMedia();
Expand Down Expand Up @@ -352,6 +360,10 @@ public function testSpaceInFilename()

public function testGetResizedUrl()
{
if (!in_array('Cms', Config::get('cms.loadModules', []))) {
$this->markTestSkipped('The CMS module is not active.');
}

$imageResizer = new ImageResizer((new CmsController())->themeUrl('assets/images/winter.png'));

Config::set('cms.linkPolicy', 'force');
Expand All @@ -365,6 +377,10 @@ public function testGetResizedUrl()

public function testGetResizerUrl()
{
if (!in_array('Cms', Config::get('cms.loadModules', []))) {
$this->markTestSkipped('The CMS module is not active.');
}

$imageResizer = new ImageResizer((new CmsController())->themeUrl('assets/images/winter.png'));

Config::set('cms.linkPolicy', 'force');
Expand Down

0 comments on commit c699d38

Please sign in to comment.