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
5f4b5876
Commit
5f4b5876
authored
Feb 03, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2293 from Ragazzo/fixture_trait_fix
moved magic methods
parents
86c6d744
13e85adc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
40 deletions
+39
-40
TestCase.php
extensions/codeception/TestCase.php
+39
-0
FixtureTrait.php
framework/test/FixtureTrait.php
+0
-40
No files found.
extensions/codeception/TestCase.php
View file @
5f4b5876
...
@@ -26,6 +26,45 @@ class TestCase extends Test
...
@@ -26,6 +26,45 @@ class TestCase extends Test
public
$appConfig
=
'@tests/unit/_config.php'
;
public
$appConfig
=
'@tests/unit/_config.php'
;
/**
/**
* Returns the value of an object property.
*
* Do not call this method directly as it is a PHP magic method that
* will be implicitly called when executing `$value = $object->property;`.
* @param string $name the property name
* @return mixed the property value
* @throws UnknownPropertyException if the property is not defined
*/
public
function
__get
(
$name
)
{
$fixture
=
$this
->
getFixture
(
$name
);
if
(
$fixture
!==
null
)
{
return
$fixture
;
}
else
{
throw
new
UnknownPropertyException
(
'Getting unknown property: '
.
get_class
(
$this
)
.
'::'
.
$name
);
}
}
/**
* Calls the named method which is not a class method.
*
* Do not call this method directly as it is a PHP magic method that
* will be implicitly called when an unknown method is being invoked.
* @param string $name the method name
* @param array $params method parameters
* @throws UnknownMethodException when calling unknown method
* @return mixed the method return value
*/
public
function
__call
(
$name
,
$params
)
{
$fixture
=
$this
->
getFixture
(
$name
);
if
(
$fixture
instanceof
ActiveFixture
)
{
return
$fixture
->
getModel
(
reset
(
$params
));
}
else
{
throw
new
UnknownMethodException
(
'Unknown method: '
.
get_class
(
$this
)
.
"::
$name
()"
);
}
}
/**
* @inheritdoc
* @inheritdoc
*/
*/
protected
function
setUp
()
protected
function
setUp
()
...
...
framework/test/FixtureTrait.php
View file @
5f4b5876
...
@@ -38,46 +38,6 @@ trait FixtureTrait
...
@@ -38,46 +38,6 @@ trait FixtureTrait
*/
*/
private
$_fixtureAliases
;
private
$_fixtureAliases
;
/**
* Returns the value of an object property.
*
* Do not call this method directly as it is a PHP magic method that
* will be implicitly called when executing `$value = $object->property;`.
* @param string $name the property name
* @return mixed the property value
* @throws UnknownPropertyException if the property is not defined
*/
public
function
__get
(
$name
)
{
$fixture
=
$this
->
getFixture
(
$name
);
if
(
$fixture
!==
null
)
{
return
$fixture
;
}
else
{
throw
new
UnknownPropertyException
(
'Getting unknown property: '
.
get_class
(
$this
)
.
'::'
.
$name
);
}
}
/**
* Calls the named method which is not a class method.
*
* Do not call this method directly as it is a PHP magic method that
* will be implicitly called when an unknown method is being invoked.
* @param string $name the method name
* @param array $params method parameters
* @throws UnknownMethodException when calling unknown method
* @return mixed the method return value
*/
public
function
__call
(
$name
,
$params
)
{
$fixture
=
$this
->
getFixture
(
$name
);
if
(
$fixture
instanceof
ActiveFixture
)
{
return
$fixture
->
getModel
(
reset
(
$params
));
}
else
{
throw
new
UnknownMethodException
(
'Unknown method: '
.
get_class
(
$this
)
.
"::
$name
()"
);
}
}
/**
/**
* Declares the fixtures that are needed by the current test case.
* Declares the fixtures that are needed by the current test case.
* The return value of this method must be an array of fixture configurations. For example,
* The return value of this method must be an array of fixture configurations. For example,
...
...
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