diff --git a/composer.json b/composer.json index 0c0285b..4055333 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "ely/php-tempmailbuster", "license": "MIT", + "type": "library", "authors": [ { "name": "ErickSkrauch", @@ -9,11 +10,26 @@ ], "require": { "php" : "~5.4|~7.0", - "lib-curl" : "*" + "lib-curl" : "*", + "ely/anti-tempmail-repo" : "*" }, "require-dev": { "phpunit/phpunit": "~4.8 || ~5.0" }, + "repositories": [ + { + "type": "package", + "package": { + "name": "ely/anti-tempmail-repo", + "version": "0.0.0", + "source": { + "url": "https://github.com/elyby/anti-tempmail-repo", + "type": "git", + "reference": "master" + } + } + } + ], "autoload": { "psr-4": { "Ely\\TempMailBuster\\": "src" diff --git a/src/Loader.php b/src/Loader.php new file mode 100644 index 0000000..1026c59 --- /dev/null +++ b/src/Loader.php @@ -0,0 +1,38 @@ +assertTrue(is_array(Loader::getPaths())); + } + + public function testLoad() + { + $this->assertTrue(is_array(Loader::load())); + } + + public function testLoadExceptionWrongPaths() + { + $this->expectException('Exception'); + LoaderWithWrongPaths::load(); + } + + public function testLoadExceptionInvalidJson() + { + $this->expectException('Exception'); + LoaderWithInvalidJson::load(); + } +} + +class LoaderWithWrongPaths extends Loader +{ + public static function getPaths() + { + return [ + __DIR__ . '/virtual_reality.json', + ]; + } +} + +class LoaderWithInvalidJson extends Loader +{ + public static function getPaths() + { + return [ + __DIR__ . '/LoaderTest.php', + ]; + } +}