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
826861f9
Commit
826861f9
authored
Feb 13, 2012
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
! Added more compatibility for 1.6+ CE and PHPUnit 3.6+
parent
73b3fbff
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
25 deletions
+56
-25
app/code/community/EcomDev/PHPUnit/Controller/Front.php
app/code/community/EcomDev/PHPUnit/Controller/Front.php
+0
-13
app/code/community/EcomDev/PHPUnit/Controller/Request/Http.php
...ode/community/EcomDev/PHPUnit/Controller/Request/Http.php
+5
-1
app/code/community/EcomDev/PHPUnit/Model/App.php
app/code/community/EcomDev/PHPUnit/Model/App.php
+1
-0
app/code/community/EcomDev/PHPUnit/Model/Layout.php
app/code/community/EcomDev/PHPUnit/Model/Layout.php
+44
-8
app/code/community/EcomDev/PHPUnit/Test/Case.php
app/code/community/EcomDev/PHPUnit/Test/Case.php
+2
-2
app/etc/local.xml.phpunit
app/etc/local.xml.phpunit
+4
-1
No files found.
app/code/community/EcomDev/PHPUnit/Controller/Front.php
View file @
826861f9
...
@@ -22,19 +22,6 @@
...
@@ -22,19 +22,6 @@
*/
*/
class
EcomDev_PHPUnit_Controller_Front
extends
Mage_Core_Controller_Varien_Front
class
EcomDev_PHPUnit_Controller_Front
extends
Mage_Core_Controller_Varien_Front
{
{
/**
* Overriden for getting rid of unusual behavior in the test case,
* because test should be isolated
*
* (non-PHPdoc)
* @see Mage_Core_Controller_Varien_Front::_checkBaseUrl()
*/
protected
function
_checkBaseUrl
()
{
// Does nothing
}
/**
/**
* Overriden for getting rid
* Overriden for getting rid
* of initialization of routers for each test case
* of initialization of routers for each test case
...
...
app/code/community/EcomDev/PHPUnit/Controller/Request/Http.php
View file @
826861f9
...
@@ -337,8 +337,12 @@ class EcomDev_PHPUnit_Controller_Request_Http
...
@@ -337,8 +337,12 @@ class EcomDev_PHPUnit_Controller_Request_Http
public
function
getHttpHost
(
$trimPort
=
false
)
public
function
getHttpHost
(
$trimPort
=
false
)
{
{
$baseUrl
=
$this
->
getBaseUrl
();
$baseUrl
=
$this
->
getBaseUrl
();
$parts
=
parse_url
(
$baseUrl
);
$parts
=
parse_url
(
$baseUrl
);
if
(
!
isset
(
$parts
[
'host'
]))
{
new
RuntimeException
(
'Cannot run controller test, because the host is not set for base url.'
);
}
$httpHost
=
$parts
[
'host'
];
$httpHost
=
$parts
[
'host'
];
if
(
!
$trimPort
&&
isset
(
$parts
[
'port'
]))
{
if
(
!
$trimPort
&&
isset
(
$parts
[
'port'
]))
{
$httpHost
.=
':'
.
$parts
[
'port'
];
$httpHost
.=
':'
.
$parts
[
'port'
];
...
...
app/code/community/EcomDev/PHPUnit/Model/App.php
View file @
826861f9
...
@@ -173,6 +173,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
...
@@ -173,6 +173,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
}
}
}
}
Mage
::
setIsDeveloperMode
(
true
);
$this
->
_config
=
Mage
::
getConfig
();
$this
->
_config
=
Mage
::
getConfig
();
$this
->
_initBaseConfig
();
$this
->
_initBaseConfig
();
$this
->
_initCache
();
$this
->
_initCache
();
...
...
app/code/community/EcomDev/PHPUnit/Model/Layout.php
View file @
826861f9
...
@@ -278,12 +278,14 @@ class EcomDev_PHPUnit_Model_Layout
...
@@ -278,12 +278,14 @@ class EcomDev_PHPUnit_Model_Layout
/**
/**
* Records action call
* Records action call
*
* (non-PHPdoc)
* (non-PHPdoc)
* @see Mage_Core_Model_Layout::_generateAction()
* @see Mage_Core_Model_Layout::_generateAction()
*/
*/
protected
function
_generateAction
(
$node
,
$parent
)
protected
function
_generateAction
(
$node
,
$parent
)
{
{
$this
->
_collectedArgs
=
null
;
$this
->
_collectedArgs
=
$this
->
_collectActionArguments
(
$node
);
$this
->
_translateLayoutNode
(
$node
,
$this
->
_collectedArgs
);
parent
::
_generateAction
(
$node
,
$parent
);
parent
::
_generateAction
(
$node
,
$parent
);
if
(
$this
->
_collectedArgs
!==
null
)
{
if
(
$this
->
_collectedArgs
!==
null
)
{
$method
=
(
string
)
$node
[
'method'
];
$method
=
(
string
)
$node
[
'method'
];
...
@@ -299,17 +301,51 @@ class EcomDev_PHPUnit_Model_Layout
...
@@ -299,17 +301,51 @@ class EcomDev_PHPUnit_Model_Layout
return
$this
;
return
$this
;
}
}
/**
/**
* Collects arguments if was not collected before
* Collects action arguments
* (non-PHPdoc)
*
* @see Mage_Core_Model_Layout::_translateLayoutNode()
* @param Varien_SimpleXml_Element $node
* @return array
*/
*/
protected
function
_
translateLayoutNode
(
$node
,
$args
)
protected
function
_
collectActionArguments
(
$node
)
{
{
parent
::
_translateLayoutNode
(
$node
,
$args
);
$args
=
(
array
)
$node
->
children
();
if
(
$this
->
_collectedArgs
===
null
)
{
unset
(
$args
[
'@attributes'
]);
$this
->
_collectedArgs
=
$args
;
foreach
(
$args
as
$key
=>
$arg
)
{
if
((
$arg
instanceof
Mage_Core_Model_Layout_Element
))
{
if
(
isset
(
$arg
[
'helper'
]))
{
$helperName
=
explode
(
'/'
,
(
string
)
$arg
[
'helper'
]);
$helperMethod
=
array_pop
(
$helperName
);
$helperName
=
implode
(
'/'
,
$helperName
);
$arg
=
$arg
->
asArray
();
unset
(
$arg
[
'@'
]);
$args
[
$key
]
=
call_user_func_array
(
array
(
Mage
::
helper
(
$helperName
),
$helperMethod
),
$arg
);
}
else
{
/**
* if there is no helper we hope that this is assoc array
*/
$arr
=
array
();
foreach
(
$arg
as
$subkey
=>
$value
)
{
$arr
[(
string
)
$subkey
]
=
$value
->
asArray
();
}
}
if
(
!
empty
(
$arr
))
{
$args
[
$key
]
=
$arr
;
}
}
}
}
if
(
isset
(
$node
[
'json'
]))
{
$json
=
explode
(
' '
,
(
string
)
$node
[
'json'
]);
foreach
(
$json
as
$arg
)
{
$args
[
$arg
]
=
Mage
::
helper
(
'core'
)
->
jsonDecode
(
$args
[
$arg
]);
}
}
return
$args
;
}
}
/**
/**
...
...
app/code/community/EcomDev/PHPUnit/Test/Case.php
View file @
826861f9
...
@@ -356,8 +356,8 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -356,8 +356,8 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
);
);
}
}
// Remove addition of /data suffix if version is more than 1.6.x
if
(
$type
==
'helper'
&&
strpos
(
$classAlias
,
'/'
)
===
false
)
{
if
(
version_compare
(
Mage
::
getVersion
(),
'1.6.0.0'
,
'<'
)
&&
$type
==
'helper'
&&
strpos
(
$classAlias
,
'/'
)
===
false
)
{
$classAlias
.=
'/data'
;
$classAlias
.=
'/data'
;
}
}
...
...
app/etc/local.xml.phpunit
View file @
826861f9
...
@@ -20,6 +20,9 @@
...
@@ -20,6 +20,9 @@
<unsecure>
<unsecure>
<base_url>
[change me]
</base_url>
<base_url>
[change me]
</base_url>
</unsecure>
</unsecure>
<url>
<redirect_to_base>
0
</redirect_to_base>
</url>
</web>
</web>
</default>
</default>
</config>
</config>
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