Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EcomDev_PHPUnit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Open
EcomDev_PHPUnit
Commits
431c3a29
Commit
431c3a29
authored
Apr 18, 2011
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
! closes feature #55 "Create mock by class alias"
parent
0cfe39ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
2 deletions
+37
-2
app/code/community/EcomDev/PHPUnit/Test/Case.php
app/code/community/EcomDev/PHPUnit/Test/Case.php
+37
-2
No files found.
app/code/community/EcomDev/PHPUnit/Test/Case.php
View file @
431c3a29
...
@@ -193,7 +193,7 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -193,7 +193,7 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
*/
*/
public
function
getGroupedClassMockBuilder
(
$type
,
$classAlias
)
public
function
getGroupedClassMockBuilder
(
$type
,
$classAlias
)
{
{
$className
=
Mage
::
getConfig
()
->
getGroupedClassName
(
$type
,
$classAlias
);
$className
=
$this
->
getGroupedClassName
(
$type
,
$classAlias
);
return
$this
->
getMockBuilder
(
$className
);
return
$this
->
getMockBuilder
(
$className
);
}
}
...
@@ -220,6 +220,17 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -220,6 +220,17 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
return
$this
->
getGroupedClassMockBuilder
(
'model'
,
$classAlias
);
return
$this
->
getGroupedClassMockBuilder
(
'model'
,
$classAlias
);
}
}
/**
* Retrieves a mock builder for a resource model class alias
*
* @param string $classAlias
* @return PHPUnit_Framework_MockObject_MockBuilder
*/
public
function
getResourceModelMockBuilder
(
$classAlias
)
{
return
$this
->
getGroupedClassMockBuilder
(
'resource_model'
,
$classAlias
);
}
/**
/**
* Retrieves a mock builder for a helper class alias
* Retrieves a mock builder for a helper class alias
*
*
...
@@ -255,6 +266,30 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -255,6 +266,30 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
$callAutoload
);
$callAutoload
);
}
}
/**
* Retrieves a mock object for the specified resource model class alias.
*
* @param string $classAlias
* @param array $methods
* @param boolean $isAbstract
* @param array $constructorArguments
* @param string $mockClassAlias
* @param boolean $callOriginalConstructor
* @param boolean $callOriginalClone
* @param boolean $callAutoload
* @return PHPUnit_Framework_MockObject_MockObject
*/
public
function
getResourceModelMock
(
$classAlias
,
$methods
=
array
(),
$isAbstract
=
false
,
array
$constructorArguments
=
array
(),
$mockClassAlias
=
''
,
$callOriginalConstructor
=
true
,
$callOriginalClone
=
true
,
$callAutoload
=
true
)
{
return
$this
->
getGroupedClassMock
(
'resource_model'
,
$methods
,
$isAbstract
,
$constructorArguments
,
$mockClassAlias
,
$callOriginalConstructor
,
$callOriginalClone
,
$callAutoload
);
}
/**
/**
* Retrieves a mock object for the specified helper class alias.
* Retrieves a mock object for the specified helper class alias.
*
*
...
@@ -338,7 +373,7 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -338,7 +373,7 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
$callOriginalClone
=
true
,
$callAutoload
=
true
)
$callOriginalClone
=
true
,
$callAutoload
=
true
)
{
{
if
(
!
empty
(
$mockClassAlias
))
{
if
(
!
empty
(
$mockClassAlias
))
{
$mockClassName
=
$this
->
getGroupedClassName
(
$type
,
$mockClassAlias
);
}
else
{
}
else
{
$mockClassName
=
''
;
$mockClassName
=
''
;
}
}
...
...
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