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
6fe26fc6
Commit
6fe26fc6
authored
Feb 03, 2012
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
! Add error messages easier clarification via new features of PHPUnit 3.6
parent
37228366
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
69 additions
and
14 deletions
+69
-14
app/code/community/EcomDev/PHPUnit/Controller/Front.php
app/code/community/EcomDev/PHPUnit/Controller/Front.php
+1
-0
app/code/community/EcomDev/PHPUnit/Test/Case.php
app/code/community/EcomDev/PHPUnit/Test/Case.php
+15
-0
lib/EcomDev/PHPUnit/Constraint/Abstract.php
lib/EcomDev/PHPUnit/Constraint/Abstract.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config.php
lib/EcomDev/PHPUnit/Constraint/Config.php
+2
-1
lib/EcomDev/PHPUnit/Constraint/Config/ClassAlias.php
lib/EcomDev/PHPUnit/Constraint/Config/ClassAlias.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config/EventObserver.php
lib/EcomDev/PHPUnit/Constraint/Config/EventObserver.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config/Layout.php
lib/EcomDev/PHPUnit/Constraint/Config/Layout.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config/Module.php
lib/EcomDev/PHPUnit/Constraint/Config/Module.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config/Node.php
lib/EcomDev/PHPUnit/Constraint/Config/Node.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config/Resource.php
lib/EcomDev/PHPUnit/Constraint/Config/Resource.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config/Resource/Script.php
lib/EcomDev/PHPUnit/Constraint/Config/Resource/Script.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config/TableAlias.php
lib/EcomDev/PHPUnit/Constraint/Config/TableAlias.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Controller/Request.php
lib/EcomDev/PHPUnit/Constraint/Controller/Request.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Controller/Response/Abstract.php
...omDev/PHPUnit/Constraint/Controller/Response/Abstract.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Json.php
lib/EcomDev/PHPUnit/Constraint/Json.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Layout/Abstract.php
lib/EcomDev/PHPUnit/Constraint/Layout/Abstract.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Or.php
lib/EcomDev/PHPUnit/Constraint/Or.php
+38
-0
No files found.
app/code/community/EcomDev/PHPUnit/Controller/Front.php
View file @
6fe26fc6
...
@@ -29,6 +29,7 @@ class EcomDev_PHPUnit_Controller_Front extends Mage_Core_Controller_Varien_Front
...
@@ -29,6 +29,7 @@ class EcomDev_PHPUnit_Controller_Front extends Mage_Core_Controller_Varien_Front
* (non-PHPdoc)
* (non-PHPdoc)
* @see Mage_Core_Controller_Varien_Front::_checkBaseUrl()
* @see Mage_Core_Controller_Varien_Front::_checkBaseUrl()
*/
*/
protected
function
_checkBaseUrl
()
protected
function
_checkBaseUrl
()
{
{
// Does nothing
// Does nothing
...
...
app/code/community/EcomDev/PHPUnit/Test/Case.php
View file @
6fe26fc6
...
@@ -66,6 +66,21 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -66,6 +66,21 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
return
Mage
::
app
();
return
Mage
::
app
();
}
}
/**
* Returns a EcomDev_PHPUnit_Constraint_Or matcher object.
*
* @return EcomDev_PHPUnit_Constraint_Or
*/
public
static
function
logicalOr
()
{
$constraints
=
func_get_args
();
$constraint
=
new
EcomDev_PHPUnit_Constraint_Or
;
$constraint
->
setConstraints
(
$constraints
);
return
$constraint
;
}
/**
/**
* Asserts that event was dispatched at least once
* Asserts that event was dispatched at least once
*
*
...
...
lib/EcomDev/PHPUnit/Constraint/Abstract.php
View file @
6fe26fc6
...
@@ -183,7 +183,7 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
...
@@ -183,7 +183,7 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
*/
*/
public
function
fail
(
$other
,
$description
,
$not
=
FALSE
)
public
function
fail
(
$other
,
$description
,
$not
=
FALSE
)
{
{
$failureDescription
=
$this
->
failureDescription
(
$other
,
$description
,
$not
);
$failureDescription
=
sprintf
(
'Failed asserting that %s'
,
$this
->
failureDescription
(
$other
,
$description
,
$not
)
);
if
(
in_array
(
$this
->
_type
,
$this
->
_typesWithDiff
))
{
if
(
in_array
(
$this
->
_type
,
$this
->
_typesWithDiff
))
{
throw
new
EcomDev_PHPUnit_Constraint_Exception
(
throw
new
EcomDev_PHPUnit_Constraint_Exception
(
...
...
lib/EcomDev/PHPUnit/Constraint/Config.php
View file @
6fe26fc6
...
@@ -123,6 +123,7 @@ class EcomDev_PHPUnit_Constraint_Config extends PHPUnit_Framework_Constraint
...
@@ -123,6 +123,7 @@ class EcomDev_PHPUnit_Constraint_Config extends PHPUnit_Framework_Constraint
*/
*/
protected
function
failureDescription
(
$other
)
protected
function
failureDescription
(
$other
)
{
{
return
$this
->
constraint
->
failureDescription
(
$other
);
$nodeValue
=
$this
->
getNodeValue
(
$other
);
return
$this
->
constraint
->
failureDescription
(
$nodeValue
);
}
}
}
}
lib/EcomDev/PHPUnit/Constraint/Config/ClassAlias.php
View file @
6fe26fc6
...
@@ -131,7 +131,7 @@ class EcomDev_PHPUnit_Constraint_Config_ClassAlias
...
@@ -131,7 +131,7 @@ class EcomDev_PHPUnit_Constraint_Config_ClassAlias
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
%s "%s/%s" %s.'
,
'%s "%s/%s" %s.'
,
$this
->
_textByGroup
[
$this
->
_group
],
$this
->
_textByGroup
[
$this
->
_group
],
$this
->
_classAliasPrefix
,
$this
->
_classAliasName
,
$this
->
_classAliasPrefix
,
$this
->
_classAliasName
,
$this
->
toString
()
$this
->
toString
()
...
...
lib/EcomDev/PHPUnit/Constraint/Config/EventObserver.php
View file @
6fe26fc6
...
@@ -169,7 +169,7 @@ class EcomDev_PHPUnit_Constraint_Config_EventObserver
...
@@ -169,7 +169,7 @@ class EcomDev_PHPUnit_Constraint_Config_EventObserver
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
%s "%s" event observer %s.'
,
'%s "%s" event observer %s.'
,
$this
->
_area
,
$this
->
_area
,
$this
->
_expectedValue
,
$this
->
_expectedValue
,
$this
->
toString
()
$this
->
toString
()
...
...
lib/EcomDev/PHPUnit/Constraint/Config/Layout.php
View file @
6fe26fc6
...
@@ -185,7 +185,7 @@ class EcomDev_PHPUnit_Constraint_Config_Layout
...
@@ -185,7 +185,7 @@ class EcomDev_PHPUnit_Constraint_Config_Layout
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
layout %s.'
,
'layout %s.'
,
$this
->
toString
()
$this
->
toString
()
);
);
}
}
...
...
lib/EcomDev/PHPUnit/Constraint/Config/Module.php
View file @
6fe26fc6
...
@@ -222,7 +222,7 @@ class EcomDev_PHPUnit_Constraint_Config_Module
...
@@ -222,7 +222,7 @@ class EcomDev_PHPUnit_Constraint_Config_Module
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
%s module %s.'
,
$this
->
_moduleName
,
$this
->
toString
()
'%s module %s.'
,
$this
->
_moduleName
,
$this
->
toString
()
);
);
}
}
}
}
lib/EcomDev/PHPUnit/Constraint/Config/Node.php
View file @
6fe26fc6
...
@@ -300,7 +300,7 @@ class EcomDev_PHPUnit_Constraint_Config_Node
...
@@ -300,7 +300,7 @@ class EcomDev_PHPUnit_Constraint_Config_Node
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
configuration node "%s" %s.'
,
$this
->
_nodePath
,
$this
->
toString
()
'configuration node "%s" %s.'
,
$this
->
_nodePath
,
$this
->
toString
()
);
);
}
}
}
}
lib/EcomDev/PHPUnit/Constraint/Config/Resource.php
View file @
6fe26fc6
...
@@ -228,7 +228,7 @@ class EcomDev_PHPUnit_Constraint_Config_Resource
...
@@ -228,7 +228,7 @@ class EcomDev_PHPUnit_Constraint_Config_Resource
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
setup resources %s.'
,
'setup resources %s.'
,
$this
->
toString
()
$this
->
toString
()
);
);
}
}
...
...
lib/EcomDev/PHPUnit/Constraint/Config/Resource/Script.php
View file @
6fe26fc6
...
@@ -358,7 +358,7 @@ class EcomDev_PHPUnit_Constraint_Config_Resource_Script
...
@@ -358,7 +358,7 @@ class EcomDev_PHPUnit_Constraint_Config_Resource_Script
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
setup resources %s.'
,
'setup resources %s.'
,
$this
->
toString
()
$this
->
toString
()
);
);
}
}
...
...
lib/EcomDev/PHPUnit/Constraint/Config/TableAlias.php
View file @
6fe26fc6
...
@@ -97,7 +97,7 @@ class EcomDev_PHPUnit_Constraint_Config_TableAlias
...
@@ -97,7 +97,7 @@ class EcomDev_PHPUnit_Constraint_Config_TableAlias
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
table alias "%s/%s" %s.'
,
'table alias "%s/%s" %s.'
,
$this
->
_tableAliasPrefix
,
$this
->
_tableAliasName
,
$this
->
_tableAliasPrefix
,
$this
->
_tableAliasName
,
$this
->
toString
()
$this
->
toString
()
);
);
...
...
lib/EcomDev/PHPUnit/Constraint/Controller/Request.php
View file @
6fe26fc6
...
@@ -301,7 +301,7 @@ class EcomDev_PHPUnit_Constraint_Controller_Request extends EcomDev_PHPUnit_Cons
...
@@ -301,7 +301,7 @@ class EcomDev_PHPUnit_Constraint_Controller_Request extends EcomDev_PHPUnit_Cons
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
request %s.'
,
'request %s.'
,
$this
->
toString
()
$this
->
toString
()
);
);
}
}
...
...
lib/EcomDev/PHPUnit/Constraint/Controller/Response/Abstract.php
View file @
6fe26fc6
...
@@ -31,7 +31,7 @@ abstract class EcomDev_PHPUnit_Constraint_Controller_Response_Abstract
...
@@ -31,7 +31,7 @@ abstract class EcomDev_PHPUnit_Constraint_Controller_Response_Abstract
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
request %s.'
,
'request %s.'
,
$this
->
toString
()
$this
->
toString
()
);
);
}
}
...
...
lib/EcomDev/PHPUnit/Constraint/Json.php
View file @
6fe26fc6
...
@@ -157,7 +157,7 @@ class EcomDev_PHPUnit_Constraint_Json extends EcomDev_PHPUnit_Constraint_Abstrac
...
@@ -157,7 +157,7 @@ class EcomDev_PHPUnit_Constraint_Json extends EcomDev_PHPUnit_Constraint_Abstrac
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
string value %s.'
,
'string value %s.'
,
$this
->
toString
()
$this
->
toString
()
);
);
}
}
...
...
lib/EcomDev/PHPUnit/Constraint/Layout/Abstract.php
View file @
6fe26fc6
...
@@ -30,7 +30,7 @@ abstract class EcomDev_PHPUnit_Constraint_Layout_Abstract extends EcomDev_PHPUni
...
@@ -30,7 +30,7 @@ abstract class EcomDev_PHPUnit_Constraint_Layout_Abstract extends EcomDev_PHPUni
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
{
return
sprintf
(
return
sprintf
(
'
Failed asserting that
layout %s.'
,
'layout %s.'
,
$this
->
toString
()
$this
->
toString
()
);
);
}
}
...
...
lib/EcomDev/PHPUnit/Constraint/Or.php
0 → 100644
View file @
6fe26fc6
<?php
/**
* PHP Unit test suite for Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @category EcomDev
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 2012 EcomDev BV (http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
/**
* Fix of comparison type for Or constraint
*/
class
EcomDev_PHPUnit_Constraint_Or
extends
PHPUnit_Framework_Constraint_Or
{
protected
function
failureDescription
(
$other
)
{
$text
=
''
;
foreach
(
$this
->
constraints
as
$key
=>
$constraint
)
{
if
(
$key
>
0
)
{
$text
.=
' or '
;
}
$text
.=
$constraint
->
failureDescription
(
$other
);
}
return
$text
;
}
}
\ No newline at end of file
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