From e78a2ccd849c9a690b336960d275309b86581aa8 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Thu, 28 Apr 2016 23:40:30 +0300 Subject: [PATCH] Return file in valid case --- tests/LoaderTest.php | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/LoaderTest.php diff --git a/tests/LoaderTest.php b/tests/LoaderTest.php new file mode 100644 index 0000000..aa4e67e --- /dev/null +++ b/tests/LoaderTest.php @@ -0,0 +1,47 @@ +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', + ]; + } +}