diff --git a/composer.json b/composer.json index 5243f583..c6b1b378 100644 --- a/composer.json +++ b/composer.json @@ -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 ./", diff --git a/tests/ActionImplementationTest.php b/tests/Actions/ActionImplementationTest.php similarity index 91% rename from tests/ActionImplementationTest.php rename to tests/Actions/ActionImplementationTest.php index 7a3c33f5..b10d44e5 100644 --- a/tests/ActionImplementationTest.php +++ b/tests/Actions/ActionImplementationTest.php @@ -1,5 +1,9 @@ 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(); } diff --git a/tests/ListActionTest.php b/tests/Actions/ListActionTest.php similarity index 96% rename from tests/ListActionTest.php rename to tests/Actions/ListActionTest.php index e914b7d3..e5ef9570 100644 --- a/tests/ListActionTest.php +++ b/tests/Actions/ListActionTest.php @@ -1,5 +1,9 @@ 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(); } diff --git a/tests/CacheImplementationTest.php b/tests/Caches/CacheImplementationTest.php similarity index 91% rename from tests/CacheImplementationTest.php rename to tests/Caches/CacheImplementationTest.php index 1e430998..12018685 100644 --- a/tests/CacheImplementationTest.php +++ b/tests/Caches/CacheImplementationTest.php @@ -1,5 +1,8 @@ class = basename($path, '.php'); + $this->class = '\\' . basename($path, '.php'); $this->assertTrue(class_exists($this->class), 'class ' . $this->class . ' doesn\'t exist'); } } diff --git a/tests/AtomFormatTest.php b/tests/Formats/AtomFormatTest.php similarity index 97% rename from tests/AtomFormatTest.php rename to tests/Formats/AtomFormatTest.php index 1d692c40..73268cb7 100644 --- a/tests/AtomFormatTest.php +++ b/tests/Formats/AtomFormatTest.php @@ -4,6 +4,9 @@ * https://tools.ietf.org/html/rfc4287 */ +namespace RssBridge\Tests\Formats; + +use FormatFactory; use PHPUnit\Framework\TestCase; class AtomFormatTest extends TestCase { diff --git a/tests/FormatImplementationTest.php b/tests/Formats/FormatImplementationTest.php similarity index 100% rename from tests/FormatImplementationTest.php rename to tests/Formats/FormatImplementationTest.php diff --git a/tests/JsonFormatTest.php b/tests/Formats/JsonFormatTest.php similarity index 97% rename from tests/JsonFormatTest.php rename to tests/Formats/JsonFormatTest.php index 9b536c18..d99c55b3 100644 --- a/tests/JsonFormatTest.php +++ b/tests/Formats/JsonFormatTest.php @@ -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 { diff --git a/tests/MrssFormatTest.php b/tests/Formats/MrssFormatTest.php similarity index 97% rename from tests/MrssFormatTest.php rename to tests/Formats/MrssFormatTest.php index ed7dc3a3..3becd8eb 100644 --- a/tests/MrssFormatTest.php +++ b/tests/Formats/MrssFormatTest.php @@ -5,6 +5,9 @@ * http://www.rssboard.org/media-rss */ +namespace RssBridge\Tests\Formats; + +use FormatFactory; use PHPUnit\Framework\TestCase; class MrssFormatTest extends TestCase { diff --git a/tests/samples/expectedAtomFormat/feed.common.xml b/tests/Formats/samples/expectedAtomFormat/feed.common.xml similarity index 100% rename from tests/samples/expectedAtomFormat/feed.common.xml rename to tests/Formats/samples/expectedAtomFormat/feed.common.xml diff --git a/tests/samples/expectedAtomFormat/feed.empty.xml b/tests/Formats/samples/expectedAtomFormat/feed.empty.xml similarity index 100% rename from tests/samples/expectedAtomFormat/feed.empty.xml rename to tests/Formats/samples/expectedAtomFormat/feed.empty.xml diff --git a/tests/samples/expectedAtomFormat/feed.emptyItems.xml b/tests/Formats/samples/expectedAtomFormat/feed.emptyItems.xml similarity index 100% rename from tests/samples/expectedAtomFormat/feed.emptyItems.xml rename to tests/Formats/samples/expectedAtomFormat/feed.emptyItems.xml diff --git a/tests/samples/expectedAtomFormat/feed.microblog.xml b/tests/Formats/samples/expectedAtomFormat/feed.microblog.xml similarity index 100% rename from tests/samples/expectedAtomFormat/feed.microblog.xml rename to tests/Formats/samples/expectedAtomFormat/feed.microblog.xml diff --git a/tests/samples/expectedJsonFormat/feed.common.json b/tests/Formats/samples/expectedJsonFormat/feed.common.json similarity index 100% rename from tests/samples/expectedJsonFormat/feed.common.json rename to tests/Formats/samples/expectedJsonFormat/feed.common.json diff --git a/tests/samples/expectedJsonFormat/feed.empty.json b/tests/Formats/samples/expectedJsonFormat/feed.empty.json similarity index 100% rename from tests/samples/expectedJsonFormat/feed.empty.json rename to tests/Formats/samples/expectedJsonFormat/feed.empty.json diff --git a/tests/samples/expectedJsonFormat/feed.emptyItems.json b/tests/Formats/samples/expectedJsonFormat/feed.emptyItems.json similarity index 100% rename from tests/samples/expectedJsonFormat/feed.emptyItems.json rename to tests/Formats/samples/expectedJsonFormat/feed.emptyItems.json diff --git a/tests/samples/expectedJsonFormat/feed.microblog.json b/tests/Formats/samples/expectedJsonFormat/feed.microblog.json similarity index 100% rename from tests/samples/expectedJsonFormat/feed.microblog.json rename to tests/Formats/samples/expectedJsonFormat/feed.microblog.json diff --git a/tests/samples/expectedMrssFormat/feed.common.xml b/tests/Formats/samples/expectedMrssFormat/feed.common.xml similarity index 100% rename from tests/samples/expectedMrssFormat/feed.common.xml rename to tests/Formats/samples/expectedMrssFormat/feed.common.xml diff --git a/tests/samples/expectedMrssFormat/feed.empty.xml b/tests/Formats/samples/expectedMrssFormat/feed.empty.xml similarity index 100% rename from tests/samples/expectedMrssFormat/feed.empty.xml rename to tests/Formats/samples/expectedMrssFormat/feed.empty.xml diff --git a/tests/samples/expectedMrssFormat/feed.emptyItems.xml b/tests/Formats/samples/expectedMrssFormat/feed.emptyItems.xml similarity index 100% rename from tests/samples/expectedMrssFormat/feed.emptyItems.xml rename to tests/Formats/samples/expectedMrssFormat/feed.emptyItems.xml diff --git a/tests/samples/expectedMrssFormat/feed.microblog.xml b/tests/Formats/samples/expectedMrssFormat/feed.microblog.xml similarity index 100% rename from tests/samples/expectedMrssFormat/feed.microblog.xml rename to tests/Formats/samples/expectedMrssFormat/feed.microblog.xml diff --git a/tests/samples/feed.common.json b/tests/Formats/samples/feed.common.json similarity index 100% rename from tests/samples/feed.common.json rename to tests/Formats/samples/feed.common.json diff --git a/tests/samples/feed.empty.json b/tests/Formats/samples/feed.empty.json similarity index 100% rename from tests/samples/feed.empty.json rename to tests/Formats/samples/feed.empty.json diff --git a/tests/samples/feed.emptyItems.json b/tests/Formats/samples/feed.emptyItems.json similarity index 100% rename from tests/samples/feed.emptyItems.json rename to tests/Formats/samples/feed.emptyItems.json diff --git a/tests/samples/feed.microblog.json b/tests/Formats/samples/feed.microblog.json similarity index 100% rename from tests/samples/feed.microblog.json rename to tests/Formats/samples/feed.microblog.json