2016-10-10 10:57:39 +02:00
|
|
|
<?php
|
|
|
|
|
2017-01-06 09:40:27 +01:00
|
|
|
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase {
|
|
|
|
|
2016-10-10 10:57:39 +02:00
|
|
|
protected $baseUrl = 'http://localhost';
|
|
|
|
|
2017-01-06 09:40:27 +01:00
|
|
|
protected $fixtureFilesAll;
|
|
|
|
protected $fixtureFilesMovie;
|
|
|
|
protected $fixtureFilesTv;
|
|
|
|
|
|
|
|
protected $fixtureAlternativeTitleMovie;
|
|
|
|
protected $fixtureAlternativeTitleTv;
|
|
|
|
|
|
|
|
protected $fixtureTmdbMovie;
|
|
|
|
protected $fixtureTmdbTv;
|
|
|
|
protected $fixtureTmdbEpisodes;
|
|
|
|
|
2016-10-10 10:57:39 +02:00
|
|
|
public function createApplication()
|
|
|
|
{
|
2017-01-06 09:40:27 +01:00
|
|
|
$this->assignFixtures();
|
|
|
|
|
|
|
|
$app = require __DIR__ . '/../bootstrap/app.php';
|
|
|
|
|
|
|
|
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
|
|
|
|
|
|
|
return $app;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function assignFixtures()
|
|
|
|
{
|
|
|
|
$this->fixtureFilesAll = json_decode(file_get_contents(__DIR__ . '/fixtures/Files/all.json'));
|
|
|
|
$this->fixtureFilesMovie = json_decode(file_get_contents(__DIR__ . '/fixtures/Files/movie.json'));
|
|
|
|
$this->fixtureFilesTv = json_decode(file_get_contents(__DIR__ . '/fixtures/Files/tv.json'));
|
|
|
|
|
|
|
|
$this->fixtureAlternativeTitleMovie = file_get_contents(__DIR__ . '/fixtures/Tmdb/alternative_titles_movie.json');
|
|
|
|
$this->fixtureAlternativeTitleTv = file_get_contents(__DIR__ . '/fixtures/Tmdb/alternative_titles_tv.json');
|
2016-10-10 10:57:39 +02:00
|
|
|
|
2017-01-06 09:40:27 +01:00
|
|
|
$this->fixtureTmdbMovie = file_get_contents(__DIR__ . '/fixtures/Tmdb/movie.json');
|
|
|
|
$this->fixtureTmdbTv = file_get_contents(__DIR__ . '/fixtures/Tmdb/tv.json');
|
|
|
|
$this->fixtureTmdbEpisodes = json_decode(file_get_contents(__DIR__ . '/fixtures/Tmdb/episodes.json'));
|
|
|
|
}
|
2016-10-10 10:57:39 +02:00
|
|
|
|
2017-01-06 09:40:27 +01:00
|
|
|
protected function createMovie()
|
|
|
|
{
|
|
|
|
factory(App\Item::class)->create([
|
|
|
|
'title' => 'Warcraft: The Beginning',
|
|
|
|
'original_title' => 'Warcraft',
|
|
|
|
'tmdb_id' => 68735,
|
|
|
|
'media_type' => 'movie',
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function createTv()
|
|
|
|
{
|
|
|
|
factory(App\Item::class)->create([
|
|
|
|
'title' => 'Game of Thrones',
|
|
|
|
'original_title' => 'Game of Thrones',
|
|
|
|
'tmdb_id' => 1399,
|
|
|
|
'media_type' => 'tv',
|
|
|
|
]);
|
|
|
|
|
|
|
|
foreach([1, 2] as $season) {
|
|
|
|
foreach([1, 2] as $episode) {
|
|
|
|
factory(App\Episode::class)->create([
|
|
|
|
'tmdb_id' => 1399,
|
|
|
|
'season_number' => $season,
|
|
|
|
'episode_number' => $episode,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getMovie()
|
|
|
|
{
|
|
|
|
return factory(App\Item::class)->states('movie')->make([
|
|
|
|
'title' => 'Findet Nemo',
|
|
|
|
'tmdb_id' => 12,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTv()
|
|
|
|
{
|
|
|
|
return factory(App\Item::class)->states('tv')->make([
|
|
|
|
'title' => 'Dragonball Z',
|
|
|
|
'tmdb_id' => 12971
|
|
|
|
]);
|
2016-10-10 10:57:39 +02:00
|
|
|
}
|
2017-01-06 09:40:27 +01:00
|
|
|
}
|