Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jleagle committed Apr 7, 2015
1 parent 71c8c3a commit ce837f4
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 4 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
strict="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite>
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
<blacklist>
<directory suffix=".php">vendor</directory>
<directory suffix=".php">tests</directory>
<directory suffix=".php">examples</directory>
</blacklist>
</filter>
</phpunit>
4 changes: 0 additions & 4 deletions src/Imdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ class Imdb
const TYPE_SERIES = 'series';
const TYPE_EPISODE = 'episode';

private function __construct()
{
}

/**
* @param string $movie
* @param string $type
Expand Down
34 changes: 34 additions & 0 deletions tests/ImdbTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
use Jleagle\Imdb\Imdb;

class ImdbTest extends PHPUnit_Framework_TestCase
{
/**
* @group medium
*/
public function testRetrieve()
{
$imdb = Imdb::search('the matrix');

$this->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));
}

}
}

0 comments on commit ce837f4

Please sign in to comment.