-
-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathTvSeasonFactoryTest.php
More file actions
101 lines (86 loc) · 3.64 KB
/
TvSeasonFactoryTest.php
File metadata and controls
101 lines (86 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <michael@wtfz.net>
* @copyright (c) 2013, Michael Roterman
* @version 4.0.0
*/
namespace Tmdb\Tests\Factory;
use Tmdb\Factory\TvSeasonFactory;
use Tmdb\Model\Tv\Season;
class TvSeasonFactoryTest extends TestCase
{
/**
* @var Season
*/
private $season;
public function setUp(): void
{
/**
* @var TvSeasonFactory $factory
*/
$factory = $this->getFactory();
$data = $this->loadByFile('tv/season/all.json');
/**
* @var Season $this->season
*/
$this->season = $factory->create($data);
}
/**
* @test
*/
public function shouldConstructTvSeason()
{
$this->assertInstanceOf('Tmdb\Model\Tv\Season', $this->season);
$this->assertInstanceOf('\DateTime', $this->season->getAirDate());
$this->assertInstanceOf('Tmdb\Model\Collection\CreditsCollection', $this->season->getCredits());
$this->assertInstanceOf('Tmdb\Model\Common\ExternalIds', $this->season->getExternalIds());
$this->assertInstanceOf('Tmdb\Model\Collection\Images', $this->season->getImages());
$this->assertInstanceOf('Tmdb\Model\Common\GenericCollection', $this->season->getEpisodes());
$this->assertInstanceOf('Tmdb\Model\Image\PosterImage', $this->season->getPosterImage());
$this->assertInstanceOf('Tmdb\Model\Common\GenericCollection', $this->season->getTranslations());
}
/**
* @test
*/
public function shouldBeAbleToSetFactories()
{
/**
* @var TvSeasonFactory $factory
*/
$factory = $this->getFactory();
$class = new \stdClass();
$factory->setCastFactory($class);
$factory->setCrewFactory($class);
$factory->setImageFactory($class);
$factory->setTvEpisodeFactory($class);
$this->assertInstanceOf('stdClass', $factory->getCastFactory());
$this->assertInstanceOf('stdClass', $factory->getCrewFactory());
$this->assertInstanceOf('stdClass', $factory->getImageFactory());
$this->assertInstanceOf('stdClass', $factory->getTvEpisodeFactory());
}
/**
* @test
*/
public function shouldBeFunctional()
{
$this->assertEquals(new \DateTime('2009-03-08'), $this->season->getAirDate());
$this->assertEquals('Season 2', $this->season->getName());
$this->assertEquals('The second season of the American television drama series Breaking Bad premiered on March 8, 2009 and concluded on May 31, 2009. It consisted of 13 episodes, each running approximately 47 minutes in length. AMC broadcast the second season on Sundays at 10:00 pm in the United States. The complete second season was released on Region 1 DVD and Region A Blu-ray on March 16, 2010.', $this->season->getOverview());
$this->assertEquals(3573, $this->season->getId());
$this->assertEquals('/rCdISteF1GPvPsy0a5L0LDffjtP.jpg', $this->season->getPosterPath());
$this->assertEquals(2, $this->season->getSeasonNumber());
$this->assertEquals("Sein Ruf eilt dem zum Meth-Dealer gewordenen Lehrer Walter voraus – das erregt die Aufmerksamkeit rivalisierender Kartelle und gefährdet seinen Schwager, einen Drogencop.",
$this->season->getTranslations()->filterLanguage('de')->getIterator()->current()->getData()['overview']
);
}
protected function getFactoryClass()
{
return 'Tmdb\Factory\TvSeasonFactory';
}
}