Updated asa -> getBehavior

This commit is contained in:
Alexander Makarov
2012-04-10 21:44:10 +02:00
parent 3e64a7e735
commit 69b49180ef
3 changed files with 4 additions and 5 deletions

View File

@ -340,7 +340,6 @@ class Component extends \yii\base\Object
/**
* Returns the named behavior object.
* The name 'asa' stands for 'as a'.
* @param string $behavior the behavior name
* @return Behavior the behavior object, or null if the behavior does not exist
*/

View File

@ -36,8 +36,8 @@ class BehaviorTest extends \yiiunit\TestCase
$bar->attachBehavior('bar', $behavior);
$this->assertEquals('behavior property', $bar->behaviorProperty);
$this->assertEquals('behavior method', $bar->behaviorMethod());
$this->assertEquals('behavior property', $bar->asa('bar')->behaviorProperty);
$this->assertEquals('behavior method', $bar->asa('bar')->behaviorMethod());
$this->assertEquals('behavior property', $bar->getBehavior('bar')->behaviorProperty);
$this->assertEquals('behavior method', $bar->getBehavior('bar')->behaviorMethod());
}
public function testAutomaticAttach()

View File

@ -165,12 +165,12 @@ class ComponentTest extends \yiiunit\TestCase
$component->test();
}
public function testAsa()
public function testGetBehavior()
{
$component = new NewComponent;
$behavior = new NewBehavior;
$component->attachBehavior('a', $behavior);
$this->assertSame($behavior, $component->asa('a'));
$this->assertSame($behavior, $component->getBehavior('a'));
}
public function testCreate()