mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Updated asa -> getBehavior
This commit is contained in:
@ -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()
|
||||
|
Reference in New Issue
Block a user