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);
 }
Exemple #2
0
 /**
  * @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.');
 }
 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']));
 }