1<?php
2/**
3 * This file is part of the Tmdb PHP API created by Michael Roterman.
4 *
5 * For the full copyright and license information, please view the LICENSE
6 * file that was distributed with this source code.
7 *
8 * @package Tmdb
9 * @author Michael Roterman <michael@wtfz.net>
10 * @copyright (c) 2013, Michael Roterman
11 * @version 0.0.1
12 */
13namespace Tmdb\Tests\Repository;
14
15use Tmdb\Repository\CollectionRepository;
16
17class CollectionRepositoryTest extends TestCase
18{
19    const COLLECTION_ID = 120;
20
21    /**
22     * @test
23     */
24    public function shouldLoadCollection()
25    {
26        $repository = $this->getRepositoryWithMockedHttpAdapter();
27
28        $this->getAdapter()->expects($this->once())
29            ->method('get')
30            ->with($this->getRequest('https://api.themoviedb.org/3/collection/'.self::COLLECTION_ID,['append_to_response'=>'images']))
31        ;
32
33        $repository->load(self::COLLECTION_ID);
34    }
35
36    /**
37     * @test
38     */
39    public function shouldGetImages()
40    {
41        $repository = $this->getRepositoryWithMockedHttpAdapter();
42
43        $this->getAdapter()->expects($this->once())
44            ->method('get')
45            ->with($this->getRequest('https://api.themoviedb.org/3/collection/'.self::COLLECTION_ID.'/images'))
46        ;
47
48        $repository->getImages(self::COLLECTION_ID);
49    }
50
51    /**
52     * @test
53     */
54    public function shouldBeAbleToSetFactories()
55    {
56        /**
57         * @var CollectionRepository $repository
58         */
59        $repository = $this->getRepositoryWithMockedHttpClient();
60        $class      = new \stdClass();
61
62        $repository->setImageFactory($class);
63
64        $this->assertInstanceOf('stdClass', $repository->getImageFactory());
65    }
66
67    protected function getApiClass()
68    {
69        return 'Tmdb\Api\Collections';
70    }
71
72    protected function getRepositoryClass()
73    {
74        return 'Tmdb\Repository\CollectionRepository';
75    }
76}
77