public function testGetCommentsFromEpisode() { $client = mock_client(200, '[ { "id": 8, "parent_id": 0, "created_at": "2011-03-25T22:35:17.000Z", "comment": "Great episode!", "spoiler": false, "review": false, "replies": 1, "user_rating": 8, "user": { "username": "******", "private": false, "name": "Sean Rudford", "vip": true, "vip_ep": false } } ]'); $auth = mock_auth(); $trakt = new Trakt($auth, $client); $comments = $trakt->episodes->comments(8, 2, 1); $this->assertInstanceOf(Collection::class, $comments); }
public function testAllShows() { $client = mock_client(200, "[]"); $auth = mock_auth(); $trakt = new Trakt($auth, $client); $res = $trakt->calendars->shows($this->today, 7); $this->assertInternalType("object", $res); }
public function testCanSetExtendedLevelOnEndpoint() { $endpoint = new Calendars\My(get_client_id(), mock_client(200, '[ { "episode":{"images": ""} } ]')); $endpoint->withImages()->withFull(); $calendar = $endpoint->shows(get_token()); $first = $calendar->first(); $this->assertObjectHasAttribute("images", $first->episode); }
function testGet() { $client = mock_client(200, '{ "id": 1, "username": "******", "email": "*****@*****.**", "points": 950, "locale": "fr", "avatar": "https://cdn.real-debrid.com/images/avatars/214239_1448981351.1865.png", "type": "premium", "premium": 4320729, "expiration": "2016-01-21T19:37:40.000Z" }'); $realDebrid = new RealDebrid(new Token(getToken()), $client); $response = $realDebrid->user->get(); $this->assertInstanceOf('RealDebrid\\Response\\User', $response); }
function testGet() { $client = mock_client(200, '{ "hoster.com": { "left": 0, "bytes": 0, "links": 0, "limit": 15, "type": "gigabytes", "extra": 0, "reset": "daily" }, "remote": { "left": 0, "type": "bytes" } }'); $realDebrid = new RealDebrid(new Token(getToken()), $client); $response = $realDebrid->traffic->get(); $this->assertInstanceOf('\\stdClass', $response); }
public function testCheckInEpisode() { $client = mock_client(201, '{ "episode": { "ids": { "trakt": 16 } }, "sharing": { "facebook": true, "twitter": true, "tumblr": false }, "message": "I\'m the one who knocks!", "app_version": "1.0", "app_date": "2014-09-22" }'); $auth = mock_auth(); $trakt = new Trakt($auth, $client); /** @var CheckIn $response */ $response = $trakt->checkIn->create(get_token(), episode($client), "Whoooot! I like this so much!"); $this->assertInstanceOf(CheckIn::class, $response); $this->assertInternalType("object", $response->media); }
public function testWatching() { $client = mock_client(200, "[]"); $auth = mock_auth(); $trakt = new Trakt($auth, $client); $res = $trakt->movies->watching($this->id); $this->assertInternalType("object", $res); }
public function testCanCheckInFromMovieObject() { $client = mock_client(201, '{ "watched_at": "2014-08-06T01:11:37.953Z", "sharing": { "facebook": true, "twitter": true, "tumblr": false }, "movie": { "title": "Guardians of the Galaxy", "year": 2014, "ids": { "trakt": 28, "slug": "guardians-of-the-galaxy-2014", "imdb": "tt2015381", "tmdb": 118340 } } }'); $movie = movie($client); $checkin = $movie->checkIn([], "Never seen this one before!"); $this->assertInstanceOf("Wubs\\Trakt\\Response\\CheckIn", $checkin); $this->assertTrue($checkin->isSharedOnFacebook()); $this->assertEquals("Guardians of the Galaxy", $checkin->media->title); }
public function testSearchMovieByIdWithAuthToken() { $client = mock_client(200, '[ { "type": "movie", "score": null, "movie": { "title": "The Avengers", "overview": "When an unexpected enemy emerges and threatens global safety and security, Nick Fury, director of the international peacekeeping agency known as S.H.I.E.L.D., finds himself in need of a team to pull the world back from the brink of disaster. Spanning the globe, a daring recruitment effort begins!", "year": 2012, "images": { "poster": { "full": "https://walter.trakt.us/images/movies/000/000/012/posters/original/293ce7103a.jpg?1406080484", "medium": "https://walter.trakt.us/images/movies/000/000/012/posters/medium/293ce7103a.jpg?1406080484", "thumb": "https://walter.trakt.us/images/movies/000/000/012/posters/thumb/293ce7103a.jpg?1406080484" }, "fanart": { "full": "https://walter.trakt.us/images/movies/000/000/012/fanarts/original/7d93500475.jpg?1406080485", "medium": "https://walter.trakt.us/images/movies/000/000/012/fanarts/medium/7d93500475.jpg?1406080485", "thumb": "https://walter.trakt.us/images/movies/000/000/012/fanarts/thumb/7d93500475.jpg?1406080485" } }, "ids": { "trakt": 12, "slug": "the-avengers-2012", "imdb": "tt0848228", "tmdb": 24428 } } } ]'); $auth = mock_auth(); $trakt = new Trakt($auth, $client); $result = $trakt->search->byId('trakt-movie', 12, get_token()); $this->assertInstanceOf(Collection::class, $result); $this->assertInternalType("object", $result->first()); $this->assertInstanceOf(Movie::class, $result->first()); }
public function testGetReplies() { $client = mock_client(201, '[ { "id": 19, "parent_id": 1, "created_at": "2014-07-27T23:06:59.000Z", "comment": "Season 2 has really picked up the action!", "spoiler": true, "review": false, "replies": 0, "likes": 0, "user_rating": 8, "user": { "username": "******", "private": false, "name": "Sean Rudford", "vip": true, "vip_ep": false } } ]'); $auth = mock_auth(); $trakt = new Trakt($auth, $client); $replies = $trakt->comments->replies(1); $this->assertInstanceOf(Collection::class, $replies); $this->assertInstanceOf(Comment::class, $replies->first()); }