-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
include __DIR__ . '/../vendor/autoload.php'; | ||
|
||
Tester\Environment::setup(); |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Tests\MovieParser\IMDB\Parser; | ||
|
||
use Tester; | ||
use MovieParser; | ||
use Atrox; | ||
|
||
|
||
include __DIR__ . '/../../../Bootstrap.php'; | ||
include __DIR__ . '/../../../../src/IMDB/Matcher.php'; | ||
include __DIR__ . '/../../../../src/IMDB/UrlBuilder.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Movie.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Role.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Person.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Character.php'; | ||
|
||
|
||
class ProcessCompanyCredits extends Tester\TestCase | ||
{ | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
|
||
public function testProcessMovie() | ||
{ | ||
$matcher = new MovieParser\IMDB\Matcher(new MovieParser\IMDB\UrlBuilder()); | ||
|
||
$html = file_get_contents(__DIR__ . '/AntMan-companyCredits.html'); | ||
|
||
$data = $matcher->processCompanyCredits($html); | ||
|
||
var_dump($data); | ||
} | ||
|
||
|
||
protected function tearDown() | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
} | ||
|
||
|
||
(new ProcessCompanyCredits())->run(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Tests\MovieParser\IMDB\Parser; | ||
|
||
use Tester; | ||
use MovieParser; | ||
use Atrox; | ||
|
||
|
||
include __DIR__ . '/../../../Bootstrap.php'; | ||
include __DIR__ . '/../../../../src/IMDB/Matcher.php'; | ||
include __DIR__ . '/../../../../src/IMDB/UrlBuilder.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Movie.php'; | ||
|
||
|
||
class ProcessConnections extends Tester\TestCase | ||
{ | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
|
||
public function testProcessMovie() | ||
{ | ||
$matcher = new MovieParser\IMDB\Matcher(new MovieParser\IMDB\UrlBuilder()); | ||
|
||
$html = file_get_contents(__DIR__ . '/AntMan-connection.html'); | ||
|
||
$data = $matcher->processConnections($html); | ||
|
||
var_dump($data); | ||
} | ||
|
||
|
||
protected function tearDown() | ||
{ | ||
parent::tearDown(); | ||
} | ||
} | ||
|
||
|
||
(new ProcessConnections())->run(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Tests\MovieParser\IMDB\Parser; | ||
|
||
use Tester; | ||
use MovieParser; | ||
use Atrox; | ||
|
||
|
||
include __DIR__ . '/../../../Bootstrap.php'; | ||
include __DIR__ . '/../../../../src/IMDB/Matcher.php'; | ||
include __DIR__ . '/../../../../src/IMDB/UrlBuilder.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Movie.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/CrazyCredit.php'; | ||
|
||
|
||
class ProcessCrazyCredit extends Tester\TestCase | ||
{ | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
|
||
public function testProcessMovie() | ||
{ | ||
$matcher = new MovieParser\IMDB\Matcher(new MovieParser\IMDB\UrlBuilder()); | ||
|
||
$html = file_get_contents(__DIR__ . '/AntMan-crazyCredits.html'); | ||
|
||
$data = $matcher->processCrazyCredits($html); | ||
|
||
var_dump($data); | ||
} | ||
|
||
|
||
protected function tearDown() | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
} | ||
|
||
|
||
(new ProcessCrazyCredit())->run(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
namespace Tests\MovieParser\IMDB\Parser; | ||
|
||
use Tester; | ||
use MovieParser; | ||
use Atrox; | ||
|
||
|
||
include __DIR__ . '/../../../Bootstrap.php'; | ||
include __DIR__ . '/../../../../src/IMDB/Matcher.php'; | ||
include __DIR__ . '/../../../../src/IMDB/UrlBuilder.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Movie.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Role.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Person.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Character.php'; | ||
|
||
|
||
class ProcessFullCredits extends Tester\TestCase | ||
{ | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
|
||
public function testProcessMovie() | ||
{ | ||
$matcher = new MovieParser\IMDB\Matcher(new MovieParser\IMDB\UrlBuilder()); | ||
$urlBuilder = new MovieParser\IMDB\UrlBuilder(); | ||
|
||
$html = file_get_contents(__DIR__ . '/AntMan-fullcredits.html'); | ||
|
||
$data = $matcher->processFullCredits($html); | ||
$entity = new MovieParser\IMDB\DTO\Movie([]); | ||
foreach ($data['cast'] as $personData) { | ||
$role = new MovieParser\IMDB\DTO\Role(); | ||
$role->setName('Cast'); | ||
$role->setType('Cast'); | ||
$role->setDescription($personData['description']); | ||
|
||
if ($personData['person']) { | ||
$person = new MovieParser\IMDB\DTO\Person(); | ||
$person->setId($urlBuilder->getId($personData['person'])); | ||
$person->setName($personData['person_name']); | ||
$role->setPerson($person); | ||
}; | ||
|
||
if ($personData['character']) { | ||
$character = new MovieParser\IMDB\DTO\Character(); | ||
$character->setId($urlBuilder->getId($personData['character'])); | ||
$character->setName($personData['character_name']); | ||
$role->setCharacter($character); | ||
} | ||
|
||
if ($personData['alias']) { | ||
$alias = new MovieParser\IMDB\DTO\Character(); | ||
$alias->setId($urlBuilder->getId($personData['alias'])); | ||
$alias->setName($personData['alias_name']); | ||
$role->setAlias($alias); | ||
} | ||
|
||
$entity->addPerson($role); | ||
} | ||
foreach ($data['crew'] as $crewData) { | ||
foreach ($crewData['people'] as $crewPerson) { | ||
if ( ! $crewPerson['person']) continue; | ||
$role = new MovieParser\IMDB\DTO\Role(); | ||
$role->setName($crewData['role_name']); | ||
$role->setType('Crew'); | ||
$role->setDescription($crewPerson['description']); | ||
|
||
$person = new MovieParser\IMDB\DTO\Person(); | ||
$person->setId($urlBuilder->getId($crewPerson['person'])); | ||
$person->setName($crewPerson['person_name']); | ||
$role->setPerson($person); | ||
|
||
$entity->addPerson($role); | ||
} | ||
} | ||
var_dump($entity); | ||
} | ||
|
||
|
||
protected function tearDown() | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
} | ||
|
||
|
||
(new ProcessFullCredits())->run(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Tests\MovieParser\IMDB\Parser; | ||
|
||
use Tester; | ||
use MovieParser; | ||
use Atrox; | ||
|
||
|
||
include __DIR__ . '/../../../Bootstrap.php'; | ||
include __DIR__ . '/../../../../src/IMDB/Matcher.php'; | ||
include __DIR__ . '/../../../../src/IMDB/UrlBuilder.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Movie.php'; | ||
|
||
|
||
class ProcessGoofs extends Tester\TestCase | ||
{ | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
|
||
public function testProcessMovie() | ||
{ | ||
$matcher = new MovieParser\IMDB\Matcher(new MovieParser\IMDB\UrlBuilder()); | ||
|
||
$html = file_get_contents(__DIR__ . '/AntMan-goofs.html'); | ||
|
||
$data = $matcher->processGoofs($html); | ||
|
||
var_dump($data); | ||
} | ||
|
||
|
||
protected function tearDown() | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
} | ||
|
||
|
||
(new ProcessGoofs())->run(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Tests\MovieParser\IMDB\Parser; | ||
|
||
use Tester; | ||
use MovieParser; | ||
use Atrox; | ||
|
||
|
||
include __DIR__ . '/../../../Bootstrap.php'; | ||
include __DIR__ . '/../../../../src/IMDB/Matcher.php'; | ||
include __DIR__ . '/../../../../src/IMDB/UrlBuilder.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Movie.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Role.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Person.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Character.php'; | ||
|
||
|
||
class ProcessKeyWords extends Tester\TestCase | ||
{ | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
|
||
public function testProcessMovie() | ||
{ | ||
$matcher = new MovieParser\IMDB\Matcher(new MovieParser\IMDB\UrlBuilder()); | ||
|
||
$html = file_get_contents(__DIR__ . '/AntMan-keyWords.html'); | ||
|
||
$data = $matcher->processKeywords($html); | ||
|
||
var_dump($data); | ||
} | ||
|
||
|
||
protected function tearDown() | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
} | ||
|
||
|
||
(new ProcessKeyWords())->run(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Tests\MovieParser\IMDB\Parser; | ||
|
||
use Tester; | ||
use MovieParser; | ||
use Atrox; | ||
|
||
|
||
include __DIR__ . '/../../../Bootstrap.php'; | ||
include __DIR__ . '/../../../../src/IMDB/Matcher.php'; | ||
include __DIR__ . '/../../../../src/IMDB/UrlBuilder.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Movie.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Role.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Person.php'; | ||
include __DIR__ . '/../../../../src/IMDB/DTO/Character.php'; | ||
|
||
|
||
class ProcessLocations extends Tester\TestCase | ||
{ | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
|
||
public function testProcessMovie() | ||
{ | ||
$matcher = new MovieParser\IMDB\Matcher(new MovieParser\IMDB\UrlBuilder()); | ||
|
||
$html = file_get_contents(__DIR__ . '/AntMan-location.html'); | ||
|
||
$data = $matcher->processLocations($html); | ||
|
||
var_dump($data); | ||
} | ||
|
||
|
||
protected function tearDown() | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
} | ||
|
||
|
||
(new ProcessLocations())->run(); |