Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Spamercz committed Jan 26, 2017
1 parent 34499a0 commit e4ea951
Show file tree
Hide file tree
Showing 55 changed files with 65,759 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
5 changes: 5 additions & 0 deletions Tests/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

include __DIR__ . '/../vendor/autoload.php';

Tester\Environment::setup();
1,827 changes: 1,827 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-companyCredits.html

Large diffs are not rendered by default.

1,715 changes: 1,715 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-connection.html

Large diffs are not rendered by default.

26,658 changes: 26,658 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-fullcredits.html

Large diffs are not rendered by default.

2,285 changes: 2,285 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-goofs.html

Large diffs are not rendered by default.

6,050 changes: 6,050 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-keyWords.html

Large diffs are not rendered by default.

1,615 changes: 1,615 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-location.html

Large diffs are not rendered by default.

1,519 changes: 1,519 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-plotSummary.html

Large diffs are not rendered by default.

3,432 changes: 3,432 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-quotes.html

Large diffs are not rendered by default.

2,126 changes: 2,126 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-release.html

Large diffs are not rendered by default.

1,206 changes: 1,206 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-synopsis.html

Large diffs are not rendered by default.

1,490 changes: 1,490 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-tagLines.html

Large diffs are not rendered by default.

1,615 changes: 1,615 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-technical.html

Large diffs are not rendered by default.

5,508 changes: 5,508 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/AntMan-trivia.html

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/ProcessCompanyCredits.phpt
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();
44 changes: 44 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/ProcessConnections.phpt
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();
46 changes: 46 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/ProcessCrazyCredits.phpt
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();
94 changes: 94 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/ProcessFullCredits.phpt
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();
45 changes: 45 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/ProcessGoofs.phpt
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();
48 changes: 48 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/ProcessKeyWords.phpt
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();
48 changes: 48 additions & 0 deletions Tests/MovieParser/Imdb/Matcher/ProcessLocations.phpt
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();
Loading

0 comments on commit e4ea951

Please sign in to comment.