Merge pull request #9 from mattsches/main

Fix compatibility with more recent versions of PHPUnit
This commit is contained in:
thrillfall 2021-07-13 11:20:16 +02:00 committed by GitHub
commit edddecd027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 15 deletions

View File

@ -4,9 +4,9 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Tests\Unit\Core\EpisodeAction; namespace OCA\GPodderSync\Tests\Unit\Core\EpisodeAction;
use OCA\GPodderSync\Core\EpisodeAction\EpisodeActionReader; 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 { public function testCreateFromString(): void {
$reader = new EpisodeActionReader(); $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}]'); $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}]');

View File

@ -4,14 +4,14 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Tests\Unit\Core\SubscriptionChange; namespace OCA\GPodderSync\Tests\Unit\Core\SubscriptionChange;
use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangesReader; 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 { public function testCreateFromString(): void {
$reader = new SubscriptionChangesReader(); $reader = new SubscriptionChangesReader();
$subscriptionChange = $reader->fromString('[https://feeds.megaphone.fm/HSW8286374095]', true); $subscriptionChange = $reader->fromString('[https://feeds.megaphone.fm/HSW8286374095]', true);
$this->assertCount(1, $subscriptionChange); $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 { public function testCreateFromEmptyString(): void {

View File

@ -5,9 +5,9 @@ namespace OCA\GPodderSync\Tests\Unit\Core\SubscriptionChange;
use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangeRequestParser; use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangeRequestParser;
use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangesReader; 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() { public function testSubscriptionRequestConvertsToSubscriptionChangeList() {
$subscriptionChangesParser = new SubscriptionChangeRequestParser( $subscriptionChangesParser = new SubscriptionChangeRequestParser(
new SubscriptionChangesReader(), new SubscriptionChangesReader(),

View File

@ -1,19 +1,15 @@
<?php <?php
if (!defined('PHPUNIT_RUN')) { if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1); define('PHPUNIT_RUN', 1);
} }
require_once __DIR__.'/../../../lib/base.php'; require_once __DIR__ . '/../../../lib/base.php';
// Fix for "Autoload path not allowed: .../tests/lib/testcase.php" // Fix for "Autoload path not allowed: .../tests/lib/testcase.php"
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
// Fix for "Autoload path not allowed: .../gpoddersync/tests/testcase.php" // Fix for "Autoload path not allowed: .../gpoddersync/tests/testcase.php"
\OC_App::loadApp('gpoddersync'); OC_App::loadApp('gpoddersync');
if(!class_exists('PHPUnit_Framework_TestCase')) {
require_once('PHPUnit/Autoload.php');
}
OC_Hook::clear(); OC_Hook::clear();

10
tests/phpunit.xml Normal file
View File

@ -0,0 +1,10 @@
<phpunit bootstrap="bootstrap.php" colors="true">
<testsuites>
<testsuite name="unit">
<directory>./Unit</directory>
</testsuite>
<testsuite name="integration">
<directory>./Integration</directory>
</testsuite>
</testsuites>
</phpunit>