Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
69b49180
Commit
69b49180
authored
Apr 10, 2012
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated asa -> getBehavior
parent
3e64a7e7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
5 deletions
+4
-5
Component.php
framework/base/Component.php
+0
-1
BehaviorTest.php
tests/unit/framework/base/BehaviorTest.php
+2
-2
ComponentTest.php
tests/unit/framework/base/ComponentTest.php
+2
-2
No files found.
framework/base/Component.php
View file @
69b49180
...
...
@@ -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
*/
...
...
tests/unit/framework/base/BehaviorTest.php
View file @
69b49180
...
...
@@ -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
()
...
...
tests/unit/framework/base/ComponentTest.php
View file @
69b49180
...
...
@@ -165,12 +165,12 @@ class ComponentTest extends \yiiunit\TestCase
$component
->
test
();
}
public
function
test
Asa
()
public
function
test
GetBehavior
()
{
$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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment