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
11a82d76
Commit
11a82d76
authored
Oct 29, 2014
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/0.3.6'
parents
e9104eec
f4397a13
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
1 deletion
+49
-1
app/code/community/EcomDev/PHPUnit/Test/Case.php
app/code/community/EcomDev/PHPUnit/Test/Case.php
+1
-0
app/code/community/EcomDev/PHPUnit/Test/Case/Helper/Mock.php
app/code/community/EcomDev/PHPUnit/Test/Case/Helper/Mock.php
+15
-0
app/code/community/EcomDev/PHPUnit/Test/Case/Util.php
app/code/community/EcomDev/PHPUnit/Test/Case/Util.php
+1
-1
lib/EcomDev/PHPUnit/Mock/Proxy.php
lib/EcomDev/PHPUnit/Mock/Proxy.php
+32
-0
No files found.
app/code/community/EcomDev/PHPUnit/Test/Case.php
View file @
11a82d76
...
@@ -24,6 +24,7 @@ use EcomDev_PHPUnit_Helper as TestHelper;
...
@@ -24,6 +24,7 @@ use EcomDev_PHPUnit_Helper as TestHelper;
*
*
* @method EcomDev_PHPUnit_Mock_Proxy mockClassAlias(string $type, $classAlias, array $methods = array(), array $constructorArgs = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockClassAlias(string $type, $classAlias, array $methods = array(), array $constructorArgs = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockModel($classAlias, array $methods = array(), array $constructorArgs = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockModel($classAlias, array $methods = array(), array $constructorArgs = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockResourceModel($classAlias, array $methods = array(), array $constructorArgs = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockBlock($classAlias, array $methods = array(), array $constructorArgs = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockBlock($classAlias, array $methods = array(), array $constructorArgs = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockHelper($classAlias, array $methods = array(), array $constructorArgs = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockHelper($classAlias, array $methods = array(), array $constructorArgs = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockSession($classAlias, array $methods = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockSession($classAlias, array $methods = array())
...
...
app/code/community/EcomDev/PHPUnit/Test/Case/Helper/Mock.php
View file @
11a82d76
...
@@ -55,6 +55,21 @@ class EcomDev_PHPUnit_Test_Case_Helper_Mock extends EcomDev_PHPUnit_AbstractHelp
...
@@ -55,6 +55,21 @@ class EcomDev_PHPUnit_Test_Case_Helper_Mock extends EcomDev_PHPUnit_AbstractHelp
return
$this
->
helperMockClassAlias
(
'model'
,
$classAlias
,
$methods
,
$constructorArgs
);
return
$this
->
helperMockClassAlias
(
'model'
,
$classAlias
,
$methods
,
$constructorArgs
);
}
}
/**
* Creates a mock for a resource model by its class alias
*
* @param string $classAlias
* @param array $methods
* @param array $constructorArgs
*
* @return EcomDev_PHPUnit_Mock_Proxy
*/
public
function
helperMockResourceModel
(
$classAlias
,
array
$methods
=
array
(),
array
$constructorArgs
=
array
())
{
return
$this
->
helperMockClassAlias
(
'resource_model'
,
$classAlias
,
$methods
,
$constructorArgs
);
}
/**
/**
* Creates a mock for a block by its class alias
* Creates a mock for a block by its class alias
*
*
...
...
app/code/community/EcomDev/PHPUnit/Test/Case/Util.php
View file @
11a82d76
...
@@ -501,7 +501,7 @@ class EcomDev_PHPUnit_Test_Case_Util
...
@@ -501,7 +501,7 @@ class EcomDev_PHPUnit_Test_Case_Util
public
static
function
getGroupedClassMockBuilder
(
PHPUnit_Framework_TestCase
$testCase
,
$type
,
$classAlias
)
public
static
function
getGroupedClassMockBuilder
(
PHPUnit_Framework_TestCase
$testCase
,
$type
,
$classAlias
)
{
{
$className
=
self
::
getGroupedClassName
(
$type
,
$classAlias
);
$className
=
self
::
getGroupedClassName
(
$type
,
$classAlias
);
return
new
EcomDev_PHPUnit_Mock_Proxy
(
$testCase
,
$className
);
return
new
EcomDev_PHPUnit_Mock_Proxy
(
$testCase
,
$className
,
$classAlias
);
}
}
/**
/**
...
...
lib/EcomDev/PHPUnit/Mock/Proxy.php
View file @
11a82d76
...
@@ -29,6 +29,26 @@ class EcomDev_PHPUnit_Mock_Proxy
...
@@ -29,6 +29,26 @@ class EcomDev_PHPUnit_Mock_Proxy
{
{
protected
$mockInstance
;
protected
$mockInstance
;
/**
* Original mocked class alias
*
* @var string
*/
protected
$classAlias
;
/**
* Added class alias as property
*
* @param PHPUnit_Framework_TestCase $testCase
* @param array|string $type
* @param null $classAlias
*/
public
function
__construct
(
PHPUnit_Framework_TestCase
$testCase
,
$type
,
$classAlias
=
null
)
{
parent
::
__construct
(
$testCase
,
$type
);
$this
->
classAlias
=
$classAlias
;
}
/**
/**
* Adds method name to a mock builder
* Adds method name to a mock builder
*
*
...
@@ -113,6 +133,18 @@ class EcomDev_PHPUnit_Mock_Proxy
...
@@ -113,6 +133,18 @@ class EcomDev_PHPUnit_Mock_Proxy
return
$this
->
getMockInstance
()
->
expects
(
$matcher
);
return
$this
->
getMockInstance
()
->
expects
(
$matcher
);
}
}
/**
* Invokes replaceByMock test util method with current mock object proxy instance
*
* @param $type
* @return $this
*/
public
function
replaceByMock
(
$type
)
{
EcomDev_PHPUnit_Test_Case_Util
::
replaceByMock
(
$type
,
$this
->
classAlias
,
$this
);
return
$this
;
}
/**
/**
* Returns invocation mocker for
* Returns invocation mocker for
*
*
...
...
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