Commit 69b49180 by Alexander Makarov

Updated asa -> getBehavior

parent 3e64a7e7
......@@ -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
*/
......
......@@ -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()
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment