コード例 #1
0
ファイル: t_unit_API.php プロジェクト: rmourembles/resto-test
 public function testCollectionsDescribe()
 {
     /*
      * Init mocked objects
      */
     // Create a stub for RestoContext class
     //$context = $this->getMockBuilder('RestoContext')->getMock();
     $config = (include dirname(__FILE__) . "/../conf/config.php");
     $context = new RestoContext($config);
     $profile = array('userid' => '1', 'email' => 'admin', 'groups' => 'admin', 'activated' => 1);
     $user = new RestoUser($profile, $context);
     $context->outputFormat = 'json';
     $context->path = "api/collections/describe";
     $this->assertEquals('api/collections/describe', $context->path);
     $route = new RestoRouteGET($context, $user);
     $responseObject = $route->route(explode('/', $context->path));
     $result = $responseObject->toJSON(false);
     $this->assertEquals('{"collections":[],"statistics":{"collection":{"Landsat":1},"instrument":{"TM":1},"platform":{"LANDSAT5":1},"processingLevel":{"LEVEL2A":1},"productType":{"REFLECTANCE":1},"sensorMode":{"XS":1}}}', $result);
 }
コード例 #2
0
ファイル: t_unit.php プロジェクト: rmourembles/resto-test
 /**
  * @expectedException              Exception
  * @expectedExceptionCode 404
  * @depends testGetCollection
  */
 public function testRestoRouteGET_api_collections_error()
 {
     $this->initContext();
     $restoRouteGET = new RestoRouteGET($this->context, $this->admin);
     $segments = array('api', 'collections');
     $restoRouteGET->route($segments);
     $this->fail('An expected exception has not been raised.');
 }
コード例 #3
0
 public function testRestoRouteGET_licenses()
 {
     $this->initContext();
     $restoRouteGET = new RestoRouteGET($this->context, $this->admin);
     $segments = array('licenses');
     $res = $restoRouteGET->route($segments);
     $this->assertEquals(true, isset($res['licenses']));
 }