public function testInherit()
 {
     $parser = Yii::createObject(['class' => ModelParser::className(), 'reflection' => new \ReflectionClass('\\tests\\models\\NewSpecialOffer')]);
     $doc = new ModelDoc();
     $parser->parse($doc);
     $doc->prepare();
     $this->assertEquals(2, count($doc->scenarios));
     $this->assertEquals(2, count($doc->extraFields));
     $this->assertEquals('string', $doc->extraFields['alpha2']->type);
     $this->assertEquals('Code country. <a href="http://example.com">Detail link.</a>', $doc->extraFields['alpha2']->description);
     $this->assertEquals('string', $doc->extraFields['full_name']->type);
     $this->assertEquals('Full name. <a href="http://example.com">Detail link.</a>', $doc->extraFields['full_name']->description);
     $this->assertEquals(5, count($doc->fields));
     $this->assertEquals('int', $doc->fields['id']->type);
     $this->assertEquals('string', $doc->fields['title']->type);
     $this->assertEquals('string', $doc->fields['comment']->type);
     $this->assertEquals('string', $doc->fields['note']->type);
     $this->assertEquals('string', $doc->fields['text']->type);
     $this->assertEquals(2, count($doc->sortFields));
     $this->assertEquals('title', $doc->sortFields['title']->name);
     $this->assertEquals('text', $doc->sortFields['text']->name);
     $this->assertTrue($doc->fields['id']->isInScenario('api-create'));
     $this->assertFalse($doc->fields['id']->isInScenario('api-update'));
     $this->assertTrue($doc->fields['text']->isInScenario('api-update'));
     $this->assertFalse($doc->fields['text']->isInScenario('api-create'));
     $this->assertTrue($doc->hasFields());
     $this->assertTrue($doc->hasExtraFields());
     $this->assertTrue($doc->hasSortFields());
 }
 public function testInherit()
 {
     $parser = Yii::createObject(['class' => ModelParser::className(), 'reflection' => new \ReflectionClass('\\tests\\models\\NewSpecialOffer')]);
     $doc = new ModelDoc();
     $parser->parse($doc);
     $doc->prepare();
     $this->assertEquals(2, count($doc->scenarios));
     $this->assertEquals(2, count($doc->extraFields));
     $this->assertEquals('string', $doc->extraFields['alpha2']->type);
     $this->assertEquals('string', $doc->extraFields['full_name']->type);
     $this->assertEquals(5, count($doc->fields));
     $this->assertEquals('int', $doc->fields['id']->type);
     $this->assertEquals('string', $doc->fields['title']->type);
     $this->assertEquals('string', $doc->fields['comment']->type);
     $this->assertEquals('string', $doc->fields['note']->type);
     $this->assertEquals('string', $doc->fields['text']->type);
     $this->assertTrue($doc->fields['id']->isInScenario('api-create'));
     $this->assertFalse($doc->fields['id']->isInScenario('api-update'));
     $this->assertTrue($doc->fields['text']->isInScenario('api-update'));
     $this->assertFalse($doc->fields['text']->isInScenario('api-create'));
 }