Skip to content

Commit

Permalink
Skip tests if module not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
J0WI committed Sep 2, 2022
1 parent 9b3486f commit ae81f31
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/lib/Image/Gmagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
use OCP\Image\Gmagick;

class ImageTest extends \Test\TestCase {
protected function setUp(): void {
if (!extension_loaded('gmagick')) {
$this->markTestSkipped('Gmagick module not available. Skipping tests');
} else {
parent::setUp();
}
}

public static function tearDownAfterClass(): void {
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
Expand Down
8 changes: 8 additions & 0 deletions tests/lib/Image/Imagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
use OCP\Image\Imagick;

class ImageTest extends \Test\TestCase {
protected function setUp(): void {
if (!extension_loaded('imagick')) {
$this->markTestSkipped('Imagick module not available. Skipping tests');
} else {
parent::setUp();
}
}

public static function tearDownAfterClass(): void {
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
Expand Down
8 changes: 8 additions & 0 deletions tests/lib/Image/Vips.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
use OCP\Image\Vips;

class ImageTest extends \Test\TestCase {
protected function setUp(): void {
if (!extension_loaded('vips')) {
$this->markTestSkipped('Vips module not available. Skipping tests');
} else {
parent::setUp();
}
}

public static function tearDownAfterClass(): void {
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
Expand Down

0 comments on commit ae81f31

Please sign in to comment.