mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-14 20:21:14 +03:00
tests: Use PSR-4-style namespaces (#2778)
We cannot yet switch to namespaces for RSS-Bridge itself but for tests we are not limited by BC. It does not actually do anything since PHPUnit will search for the test files without the help of the autoloader but it still makes the directory cleaner.
This commit is contained in:
parent
90d22f0d80
commit
44e8007d9c
25 changed files with 34 additions and 4 deletions
|
@ -39,6 +39,11 @@
|
|||
"ext-sqlite3": "Allows to use an SQLite database for caching",
|
||||
"ext-dom": "Allows to use some bridges based on XPath expressions"
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"RssBridge\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "./vendor/bin/phpunit",
|
||||
"lint": "./vendor/bin/phpcs --standard=phpcs.xml --warning-severity=0 --extensions=php -p ./",
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace RssBridge\Tests\Actions;
|
||||
|
||||
use ActionAbstract;
|
||||
use ActionInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ActionImplementationTest extends TestCase {
|
||||
|
@ -48,7 +52,7 @@ class ActionImplementationTest extends TestCase {
|
|||
}
|
||||
|
||||
private function setAction($path) {
|
||||
$this->class = basename($path, '.php');
|
||||
$this->class = '\\' . basename($path, '.php');
|
||||
$this->assertTrue(class_exists($this->class), 'class ' . $this->class . ' doesn\'t exist');
|
||||
$this->obj = new $this->class();
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace RssBridge\Tests\Actions;
|
||||
|
||||
use ActionFactory;
|
||||
use BridgeFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ListActionTest extends TestCase {
|
|
@ -1,5 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace RssBridge\Tests\Bridges;
|
||||
|
||||
use BridgeAbstract;
|
||||
use BridgeInterface;
|
||||
use FeedExpander;
|
||||
use PixivBridge;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BridgeImplementationTest extends TestCase {
|
||||
|
@ -216,7 +222,7 @@ class BridgeImplementationTest extends TestCase {
|
|||
}
|
||||
|
||||
private function setBridge($path) {
|
||||
$this->class = basename($path, '.php');
|
||||
$this->class = '\\' . basename($path, '.php');
|
||||
$this->assertTrue(class_exists($this->class), 'class ' . $this->class . ' doesn\'t exist');
|
||||
$this->obj = new $this->class();
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace RssBridge\Tests\Caches;
|
||||
|
||||
use CacheInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CacheImplementationTest extends TestCase {
|
||||
|
@ -34,7 +37,7 @@ class CacheImplementationTest extends TestCase {
|
|||
}
|
||||
|
||||
private function setCache($path) {
|
||||
$this->class = basename($path, '.php');
|
||||
$this->class = '\\' . basename($path, '.php');
|
||||
$this->assertTrue(class_exists($this->class), 'class ' . $this->class . ' doesn\'t exist');
|
||||
}
|
||||
}
|
|
@ -4,6 +4,9 @@
|
|||
* https://tools.ietf.org/html/rfc4287
|
||||
*/
|
||||
|
||||
namespace RssBridge\Tests\Formats;
|
||||
|
||||
use FormatFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AtomFormatTest extends TestCase {
|
|
@ -3,8 +3,10 @@
|
|||
* JsonFormat - JSON Feed Version 1
|
||||
* https://jsonfeed.org/version/1
|
||||
*/
|
||||
require_once __DIR__ . '/../lib/rssbridge.php';
|
||||
|
||||
namespace RssBridge\Tests\Formats;
|
||||
|
||||
use FormatFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class JsonFormatTest extends TestCase {
|
|
@ -5,6 +5,9 @@
|
|||
* http://www.rssboard.org/media-rss
|
||||
*/
|
||||
|
||||
namespace RssBridge\Tests\Formats;
|
||||
|
||||
use FormatFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class MrssFormatTest extends TestCase {
|
Loading…
Add table
Reference in a new issue