コード例 #1
0
 public function testMovieInfoFactory()
 {
     try {
         $this->assertEquals(771416235, RottenFactory::makeRotten()->getMovieInfo(771416235)[0]->getId());
         $this->assertEquals(771421904, RottenFactory::makeRotten()->getMovieInfo(771421904)[0]->getId());
         $this->assertEquals(771416235, RottenFactory::makeRotten()->getMovieInfo(771416235)[0]->getId());
         $this->assertEquals(771371532, RottenFactory::makeRotten()->getMovieInfo(771371532)[0]->getId());
     } catch (\Exception $ex) {
         print sprintf('%s%s%s', $ex->getFile(), $ex->getLine(), $ex->getMessage());
     }
 }
コード例 #2
0
<?php

require 'autoload.php';
use rotten\RottenApi\RottenApi;
use rotten\RottenApi\RottenFactory;
/**
 * Search Iron Man and view results
 */
$tt = new RottenApi();
print $tt->search('Iron Man', '1');
/**
 * Upcoming movies
 */
$t2 = new RottenApi();
print_r($t2->getUpcomingMovies());
/**
 * Get in theater movies
 */
print_r(RottenFactory::makeRotten()->getInTheatreMovies());
/**
 * Get movie info with movie id. Use factory
 */
print_r(RottenFactory::makeRotten()->getMovieInfo(771416235));
/**
 * Get opening movies with factory
 */
print_r(RottenFactory::makeRotten()->getOpeningMovies());