Пример #1
0
 protected function setUp()
 {
     $mockData = $this->getMockData('license');
     $this->setMockResponses([[200, $mockData]]);
     $mapper = ResourceMapperFactory::factory('enterprise', $this->getAdapter());
     $this->resource = $mapper->findLicense();
 }
 protected function setUp()
 {
     $name = $this->getResourceName();
     $jsonFilename = Inflector::get()->pluralize(strtolower($name));
     $mockData = $this->getMockData($jsonFilename);
     $this->setMockResponses([[200, $mockData]]);
     $mapper = ResourceMapperFactory::factory($name, $this->getAdapter());
     $collection = $mapper->findAll();
     $this->resource = $collection->current();
 }
 /**
  * @param $uri
  * @param $options
  * @return array|Collection
  * @throws \GitHub\Resource\Exception\ResourceNotFoundException
  */
 protected function findCollection($uri, $options)
 {
     preg_match('/(\\w+)Mapper/i', get_class($this), $matches);
     $collection = new Collection();
     $results = $this->getAdapter()->get($uri, $options);
     foreach ($results as $result) {
         $login = $result['owner']['login'];
         $result['owner'] = ResourceMapperFactory::factory('user', $this->getAdapter())->find($login);
         $collection[] = new Repository($result);
     }
     return $collection;
 }
 protected function setUp()
 {
     $name = $this->getResourceName();
     $this->mapper = ResourceMapperFactory::factory($name, $this->getAdapter());
 }
Пример #5
0
 protected function getResourceMapper($resource)
 {
     return ResourceMapperFactory::factory($resource, $this->getAdapter());
 }
 /**
  * @dataProvider getResourceAliases
  * @param string $alias
  */
 public function testResourceAlias($alias)
 {
     $mapper = ResourceMapperFactory::factory($alias, $this->getAdapter());
     $this->assertInstanceOf('\\GitHub\\Resource\\ResourceMapperInterface', $mapper);
 }
Пример #7
0
 protected function setUp()
 {
     $name = $this->getResourceName();
     $this->setMockResponses([[200, $this->getMockData('repositories')], [200, $this->getMockData('users')[0]]]);
     $mapper = ResourceMapperFactory::factory($name, $this->getAdapter());
     $collection = $mapper->findAll();
     $this->resource = $collection->current();
 }
Пример #8
0
 /**
  * {@inheritdoc}
  */
 public function resource($name)
 {
     return ResourceMapperFactory::factory($name, $this->getAdapter());
 }