public function testTags()
 {
     $parser = Yii::createObject(['class' => ControllerParser::className(), 'reflection' => new \ReflectionClass('\\tests\\controllers\\ProductController')]);
     $doc = new ControllerDoc();
     $parser->parseClass($doc);
     $doc->prepare();
     $this->assertEquals('name', $doc->query[0]->variableName);
     $this->assertEquals('false', $doc->query[0]->defaultValue);
     $this->assertTrue($doc->hasLabel('labelA'));
     $this->assertFalse($doc->hasLabel('labelB'));
 }
Esempio n. 2
0
 /**
  * @param $className
  * @param null $objectConfig
  * @throws \yii\base\InvalidConfigException
  */
 private function addControllerDoc($className, $objectConfig = null)
 {
     $parser = Yii::createObject(['class' => ControllerParser::className(), 'reflection' => new \ReflectionClass($className), 'objectConfig' => $objectConfig]);
     $doc = new ControllerDoc();
     if ($parser->parse($doc) === false) {
         Yii::error($parser->error, 'restdoc');
     } else {
         $doc->prepare();
         $this->_controllers[$doc->path] = $doc;
     }
 }