コード例 #1
0
 /**
  * @test
  */
 public function normalCases()
 {
     $this->assertEquals('something id', $this->subject->description());
     $this->assertEquals('sampleId', $this->subject->name());
     $this->assertEquals('string', $this->subject->type());
     $this->assertEquals('path', $this->subject->paramType());
 }
コード例 #2
0
 /**
  * Set routes and nested resources based on the models
  *
  * @param string|arrau $model the name of the resource or an array of names
  * @param array $options array of options - see the usage description
  * @param string $parent the name of the parent route
  */
 public static function set($name, array $options = array(), $parent = NULL)
 {
     if (Arr::is_array($name)) {
         $resources = array();
         foreach ($name as $resource_name) {
             $resources[] = Resource::set($resource_name, $options, $parent);
         }
         return $resources;
     }
     $resource = new Resource($name, $options, $parent);
     return Resource::$_resources[$resource->name()] = $resource;
 }
コード例 #3
0
ファイル: Index.php プロジェクト: openbuildings/jam-resource
 private function _resource(Resource $resource)
 {
     $resource_string = "\n" . Minion_CLI::color(' ' . $resource->name(), 'green');
     if ($this->_options['actions'] !== FALSE) {
         $resource_string .= $this->_resource_actions($resource);
     } elseif ($this->_options['uris'] !== FALSE) {
         $resource_string .= $this->_resource_uris($resource);
     }
     foreach ($resource->children() as $child_resource_name) {
         $resource_string .= "\n" . '   ' . Minion_CLI::color(substr($child_resource_name, strlen($resource->name()) + 1), 'cyan');
         if ($this->_options['actions'] !== FALSE) {
             $resource_string .= $this->_resource_actions(Resource::get($child_resource_name), '  ');
         } elseif ($this->_options['uris'] !== FALSE) {
             $resource_string .= $this->_resource_uris(Resource::get($child_resource_name), '  ');
         }
     }
     $resource_string .= "\n";
     return $resource_string;
 }