diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..042c147 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: php + +php: + - 5.4 + - 5.5 + - 5.6 + - hhvm + +before_install: + - composer self-update + - composer install --no-interaction --prefer-source + +script: + - mkdir -p build/logs + - phpunit --coverage-clover build/logs/clover.xml diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..75dd1eb --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,28 @@ + + + + + tests + + + + + src + + + vendor + tests + examples + + + diff --git a/src/Imdb.php b/src/Imdb.php index a9c7acf..7b7db4b 100644 --- a/src/Imdb.php +++ b/src/Imdb.php @@ -12,10 +12,6 @@ class Imdb const TYPE_SERIES = 'series'; const TYPE_EPISODE = 'episode'; - private function __construct() - { - } - /** * @param string $movie * @param string $type diff --git a/tests/ImdbTest.php b/tests/ImdbTest.php new file mode 100644 index 0000000..cf03205 --- /dev/null +++ b/tests/ImdbTest.php @@ -0,0 +1,34 @@ +assertTrue(is_array($imdb)); + $this->assertEquals('Jleagle\Imdb\Responses\Result', get_class($imdb[0])); + } + + /** + * @group medium + */ + public function testSearch() + { + foreach(['the matrix', 'tt0133093'] as $search) + { + $imdb = Imdb::retrieve($search); + + $this->assertEquals('Jleagle\Imdb\Responses\Movie', get_class($imdb)); + $this->assertEquals('The Matrix', $imdb->title); + + $array = $imdb->toArray(); + $this->assertTrue(is_array($array)); + } + + } +}