Browse Source

Updated asa -> getBehavior

tags/2.0.0-beta
Alexander Makarov 13 years ago
parent
commit
69b49180ef
  1. 1
      framework/base/Component.php
  2. 4
      tests/unit/framework/base/BehaviorTest.php
  3. 4
      tests/unit/framework/base/ComponentTest.php

1
framework/base/Component.php

@ -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
*/

4
tests/unit/framework/base/BehaviorTest.php

@ -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()

4
tests/unit/framework/base/ComponentTest.php

@ -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()

Loading…
Cancel
Save