From cd5a77281e1fa4ff116006962bdcf4d7a0a69168 Mon Sep 17 00:00:00 2001 From: Matthias Gutjahr Date: Tue, 13 Jul 2021 09:43:54 +0200 Subject: [PATCH] Fix compatibility with more recent versions of PHPUnit --- .../Core/EpisodeAction/EpisodeActionReaderTest.php | 4 ++-- .../SubscriptionChangeReaderTest.php | 6 +++--- .../SubscriptionChangeRequestParserTest.php | 4 ++-- tests/bootstrap.php | 12 ++++-------- tests/phpunit.xml | 10 ++++++++++ 5 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 tests/phpunit.xml diff --git a/tests/Unit/Core/EpisodeAction/EpisodeActionReaderTest.php b/tests/Unit/Core/EpisodeAction/EpisodeActionReaderTest.php index 685b2be..93ec74f 100644 --- a/tests/Unit/Core/EpisodeAction/EpisodeActionReaderTest.php +++ b/tests/Unit/Core/EpisodeAction/EpisodeActionReaderTest.php @@ -4,9 +4,9 @@ declare(strict_types=1); namespace OCA\GPodderSync\Tests\Unit\Core\EpisodeAction; use OCA\GPodderSync\Core\EpisodeAction\EpisodeActionReader; -use PHPUnit_Framework_TestCase; +use Test\TestCase; -class EpisodeActionReaderTest extends PHPUnit_Framework_TestCase { +class EpisodeActionReaderTest extends TestCase { public function testCreateFromString(): void { $reader = new EpisodeActionReader(); $episodeAction = $reader->fromString('[EpisodeAction{podcast=\'https://feeds.simplecast.com/wEl4UUJZ\', episode=\'https://chrt.fm/track/47G541/injector.simplecastaudio.com/f16c3da7-cf46-4a42-99b7-8467255c6086/episodes/e8e24c01-6157-40e8-9b5a-45d539aeb7e6/audio/128/default.mp3?aid=rss_feed&awCollectionId=f16c3da7-cf46-4a42-99b7-8467255c6086&awEpisodeId=e8e24c01-6157-40e8-9b5a-45d539aeb7e6&feed=wEl4UUJZ\', action=PLAY, timestamp=Tue May 18 23:45:11 GMT+02:00 2021, started=31, position=36, total=2474}]'); diff --git a/tests/Unit/Core/SubscriptionChange/SubscriptionChangeReaderTest.php b/tests/Unit/Core/SubscriptionChange/SubscriptionChangeReaderTest.php index 05f2295..7e14dfd 100644 --- a/tests/Unit/Core/SubscriptionChange/SubscriptionChangeReaderTest.php +++ b/tests/Unit/Core/SubscriptionChange/SubscriptionChangeReaderTest.php @@ -4,14 +4,14 @@ declare(strict_types=1); namespace OCA\GPodderSync\Tests\Unit\Core\SubscriptionChange; use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangesReader; -use PHPUnit_Framework_TestCase; +use Test\TestCase; -class SubscriptionChangeReaderTest extends PHPUnit_Framework_TestCase { +class SubscriptionChangeReaderTest extends TestCase { public function testCreateFromString(): void { $reader = new SubscriptionChangesReader(); $subscriptionChange = $reader->fromString('[https://feeds.megaphone.fm/HSW8286374095]', true); $this->assertCount(1, $subscriptionChange); - $this->assertSame("https://feeds.megaphone.fm/HSW8286374095", $subscriptionChange[0]->getUrl()); + $this->assertSame("https://feeds.megaphone.fm/HSW8286374095", $subscriptionChange[0]->getUrl()); } public function testCreateFromEmptyString(): void { diff --git a/tests/Unit/Core/SubscriptionChange/SubscriptionChangeRequestParserTest.php b/tests/Unit/Core/SubscriptionChange/SubscriptionChangeRequestParserTest.php index 44f67e9..ea6150a 100644 --- a/tests/Unit/Core/SubscriptionChange/SubscriptionChangeRequestParserTest.php +++ b/tests/Unit/Core/SubscriptionChange/SubscriptionChangeRequestParserTest.php @@ -5,9 +5,9 @@ namespace OCA\GPodderSync\Tests\Unit\Core\SubscriptionChange; use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangeRequestParser; use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangesReader; -use PHPUnit_Framework_TestCase; +use Test\TestCase; -class SubscriptionChangeRequestParserTest extends PHPUnit_Framework_TestCase { +class SubscriptionChangeRequestParserTest extends TestCase { public function testSubscriptionRequestConvertsToSubscriptionChangeList() { $subscriptionChangesParser = new SubscriptionChangeRequestParser( new SubscriptionChangesReader(), diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4e70b91..b5ef026 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,19 +1,15 @@ addValidRoot(OC::$SERVERROOT . '/tests'); +OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); // Fix for "Autoload path not allowed: .../gpoddersync/tests/testcase.php" -\OC_App::loadApp('gpoddersync'); - -if(!class_exists('PHPUnit_Framework_TestCase')) { - require_once('PHPUnit/Autoload.php'); -} +OC_App::loadApp('gpoddersync'); OC_Hook::clear(); diff --git a/tests/phpunit.xml b/tests/phpunit.xml new file mode 100644 index 0000000..6b41a41 --- /dev/null +++ b/tests/phpunit.xml @@ -0,0 +1,10 @@ + + + + ./Unit + + + ./Integration + + +