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
d7fb0f16
Commit
d7fb0f16
authored
Feb 02, 2012
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev'
parents
85757c0b
7ff0baed
Changes
57
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
57 changed files
with
2075 additions
and
224 deletions
+2075
-224
README.md
README.md
+6
-2
app/code/community/EcomDev/PHPUnit/Controller/Front.php
app/code/community/EcomDev/PHPUnit/Controller/Front.php
+1
-1
app/code/community/EcomDev/PHPUnit/Controller/Request/Http.php
...ode/community/EcomDev/PHPUnit/Controller/Request/Http.php
+1
-1
app/code/community/EcomDev/PHPUnit/Controller/Response/Http.php
...de/community/EcomDev/PHPUnit/Controller/Response/Http.php
+1
-1
app/code/community/EcomDev/PHPUnit/Model/App.php
app/code/community/EcomDev/PHPUnit/Model/App.php
+42
-14
app/code/community/EcomDev/PHPUnit/Model/App/Area.php
app/code/community/EcomDev/PHPUnit/Model/App/Area.php
+2
-1
app/code/community/EcomDev/PHPUnit/Model/Config.php
app/code/community/EcomDev/PHPUnit/Model/Config.php
+31
-29
app/code/community/EcomDev/PHPUnit/Model/Design/Package.php
app/code/community/EcomDev/PHPUnit/Model/Design/Package.php
+6
-1
app/code/community/EcomDev/PHPUnit/Model/Expectation/Interface.php
...community/EcomDev/PHPUnit/Model/Expectation/Interface.php
+1
-1
app/code/community/EcomDev/PHPUnit/Model/Expectation/Object.php
...de/community/EcomDev/PHPUnit/Model/Expectation/Object.php
+1
-1
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
+452
-50
app/code/community/EcomDev/PHPUnit/Model/Fixture/Interface.php
...ode/community/EcomDev/PHPUnit/Model/Fixture/Interface.php
+75
-2
app/code/community/EcomDev/PHPUnit/Model/Layout.php
app/code/community/EcomDev/PHPUnit/Model/Layout.php
+1
-1
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
+22
-8
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Abstract.php
...ity/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Abstract.php
+60
-3
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Abstract.php
...Dev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Abstract.php
+4
-2
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Category.php
...Dev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Category.php
+1
-1
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Product.php
...mDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Product.php
+4
-5
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Default.php
...nity/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Default.php
+1
-1
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Exception.php
...munity/EcomDev/PHPUnit/Model/Mysql4/Fixture/Exception.php
+9
-0
app/code/community/EcomDev/PHPUnit/Model/Test/Loadable/Interface.php
...mmunity/EcomDev/PHPUnit/Model/Test/Loadable/Interface.php
+1
-1
app/code/community/EcomDev/PHPUnit/Test/Case.php
app/code/community/EcomDev/PHPUnit/Test/Case.php
+134
-28
app/code/community/EcomDev/PHPUnit/Test/Case/Config.php
app/code/community/EcomDev/PHPUnit/Test/Case/Config.php
+348
-11
app/code/community/EcomDev/PHPUnit/Test/Case/Controller.php
app/code/community/EcomDev/PHPUnit/Test/Case/Controller.php
+3
-3
app/code/community/EcomDev/PHPUnit/Test/Suite.php
app/code/community/EcomDev/PHPUnit/Test/Suite.php
+3
-3
app/code/community/EcomDev/PHPUnit/Test/Suite/Group.php
app/code/community/EcomDev/PHPUnit/Test/Suite/Group.php
+22
-7
app/code/community/EcomDev/PHPUnit/etc/config.xml
app/code/community/EcomDev/PHPUnit/etc/config.xml
+1
-1
lib/EcomDev/PHPUnit/Constraint/Abstract.php
lib/EcomDev/PHPUnit/Constraint/Abstract.php
+48
-7
lib/EcomDev/PHPUnit/Constraint/Config.php
lib/EcomDev/PHPUnit/Constraint/Config.php
+3
-3
lib/EcomDev/PHPUnit/Constraint/Config/Abstract.php
lib/EcomDev/PHPUnit/Constraint/Config/Abstract.php
+3
-3
lib/EcomDev/PHPUnit/Constraint/Config/EventObserver.php
lib/EcomDev/PHPUnit/Constraint/Config/EventObserver.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config/Interface.php
lib/EcomDev/PHPUnit/Constraint/Config/Interface.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Config/Layout.php
lib/EcomDev/PHPUnit/Constraint/Config/Layout.php
+3
-3
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
+236
-0
lib/EcomDev/PHPUnit/Constraint/Config/Resource/Script.php
lib/EcomDev/PHPUnit/Constraint/Config/Resource/Script.php
+365
-0
lib/EcomDev/PHPUnit/Constraint/Config/TableAlias.php
lib/EcomDev/PHPUnit/Constraint/Config/TableAlias.php
+105
-0
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/Controller/Response/Body.php
lib/EcomDev/PHPUnit/Constraint/Controller/Response/Body.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Controller/Response/Header.php
...EcomDev/PHPUnit/Constraint/Controller/Response/Header.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Exception.php
lib/EcomDev/PHPUnit/Constraint/Exception.php
+9
-5
lib/EcomDev/PHPUnit/Constraint/Json.php
lib/EcomDev/PHPUnit/Constraint/Json.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Layout.php
lib/EcomDev/PHPUnit/Constraint/Layout.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Layout/Abstract.php
lib/EcomDev/PHPUnit/Constraint/Layout/Abstract.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Layout/Block.php
lib/EcomDev/PHPUnit/Constraint/Layout/Block.php
+26
-3
lib/EcomDev/PHPUnit/Constraint/Layout/Block/Action.php
lib/EcomDev/PHPUnit/Constraint/Layout/Block/Action.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Layout/Block/Property.php
lib/EcomDev/PHPUnit/Constraint/Layout/Block/Property.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Layout/Handle.php
lib/EcomDev/PHPUnit/Constraint/Layout/Handle.php
+1
-1
lib/EcomDev/PHPUnit/Constraint/Layout/Logger/Interface.php
lib/EcomDev/PHPUnit/Constraint/Layout/Logger/Interface.php
+1
-1
lib/EcomDev/PHPUnit/Controller/Request/Interface.php
lib/EcomDev/PHPUnit/Controller/Request/Interface.php
+1
-1
lib/EcomDev/PHPUnit/Controller/Response/Interface.php
lib/EcomDev/PHPUnit/Controller/Response/Interface.php
+1
-1
lib/EcomDev/PHPUnit/Design/Package/Interface.php
lib/EcomDev/PHPUnit/Design/Package/Interface.php
+1
-1
lib/EcomDev/PHPUnit/Isolation/Interface.php
lib/EcomDev/PHPUnit/Isolation/Interface.php
+1
-1
lib/EcomDev/Utils/Reflection.php
lib/EcomDev/Utils/Reflection.php
+18
-1
modman
modman
+7
-1
No files found.
README.md
View file @
d7fb0f16
...
@@ -8,7 +8,7 @@ This extension was created especially for resolving this problem and promoting t
...
@@ -8,7 +8,7 @@ This extension was created especially for resolving this problem and promoting t
System Requirements
System Requirements
-------------------
-------------------
*
PHP 5.3 or higher
*
PHP 5.3 or higher
*
PHPUnit 3.
5
*
PHPUnit 3.
6.x
*
Magento CE1.4.x-1.5.x/PE1.9.x-PE1.10.x/EE1.9.x-1.10.x
*
Magento CE1.4.x-1.5.x/PE1.9.x-PE1.10.x/EE1.9.x-1.10.x
Documentation
Documentation
...
@@ -40,6 +40,8 @@ required for proper controller tests.
...
@@ -40,6 +40,8 @@ required for proper controller tests.
4.
Run the unit tests first time for installing test database. It will take about 3 minutes.
4.
Run the unit tests first time for installing test database. It will take about 3 minutes.
$ phpunit UnitTests.php
5.
If it shows that there was no tests found, it means that extension was successfully
5.
If it shows that there was no tests found, it means that extension was successfully
installed. If it shows some errors than it means that your customizations has install
installed. If it shows some errors than it means that your customizations has install
scripts that relay on your current database data so you should fix them.
scripts that relay on your current database data so you should fix them.
...
@@ -58,6 +60,8 @@ required for proper controller tests.
...
@@ -58,6 +60,8 @@ required for proper controller tests.
3.
Run the unit tests first time for installing test database. It will take about 3 minutes.
3.
Run the unit tests first time for installing test database. It will take about 3 minutes.
$ phpunit UnitTests.php
4.
If it shows that there was no tests found, it means that extension was successfully
4.
If it shows that there was no tests found, it means that extension was successfully
installed. If it shows some errors than it means that your customizations has install
installed. If it shows some errors than it means that your customizations has install
scripts that relay on your current database data so you should fix them.
scripts that relay on your current database data so you should fix them.
...
...
app/code/community/EcomDev/PHPUnit/Controller/Front.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Controller/Request/Http.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Controller/Response/Http.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Model/App.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -48,6 +48,8 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
...
@@ -48,6 +48,8 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
const
REGISTRY_PATH_LAYOUT_SINGLETON
=
'_singleton/core/layout'
;
const
REGISTRY_PATH_LAYOUT_SINGLETON
=
'_singleton/core/layout'
;
const
REGISTRY_PATH_DESIGN_PACKAGE_SINGLETON
=
'_singleton/core/design_package'
;
const
REGISTRY_PATH_DESIGN_PACKAGE_SINGLETON
=
'_singleton/core/design_package'
;
const
REGISTRY_PATH_SHARED_STORAGE
=
'test_suite_shared_storage'
;
const
XML_PATH_LAYOUT_MODEL_FOR_TEST
=
'phpunit/suite/layout/model'
;
const
XML_PATH_LAYOUT_MODEL_FOR_TEST
=
'phpunit/suite/layout/model'
;
const
XML_PATH_DESIGN_PACKAGE_MODEL_FOR_TEST
=
'phpunit/suite/design/package/model'
;
const
XML_PATH_DESIGN_PACKAGE_MODEL_FOR_TEST
=
'phpunit/suite/design/package/model'
;
...
@@ -152,7 +154,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
...
@@ -152,7 +154,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_events'
,
new
self
::
$_eventCollectionClass
);
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_events'
,
new
self
::
$_eventCollectionClass
);
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_registry'
,
array
());
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
'Mage'
,
'_registry'
,
array
());
// All unit tests will be run
ned
in admin scope, to get rid of frontend restrictions
// All unit tests will be run in admin scope, to get rid of frontend restrictions
Mage
::
app
()
->
initTest
();
Mage
::
app
()
->
initTest
();
}
}
...
@@ -177,20 +179,16 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
...
@@ -177,20 +179,16 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
// Set using cache
// Set using cache
// for things that shouldn't be reloaded each time
// for things that shouldn't be reloaded each time
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
$this
->
setCacheOptions
(
array
(
$this
->
_cache
,
'_allowedCacheOptions'
,
array
(
'eav'
=>
1
,
'eav'
=>
1
,
'layout'
=>
1
,
'layout'
=>
1
,
'translate'
=>
1
'translate'
=>
1
)
));
);
// Clean cache before the whole suite is running
// Clean cache before the whole suite is running
$this
->
getCache
()
->
clean
();
$this
->
getCache
()
->
clean
();
// Init modules runs install proc
c
ess for table structures,
// Init modules runs install process for table structures,
// It is required for setting up proper setup script
// It is required for setting up proper setup script
$this
->
_initModules
();
$this
->
_initModules
();
...
@@ -221,9 +219,39 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
...
@@ -221,9 +219,39 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
$designPackageModel
);
$designPackageModel
);
$this
->
loadAreaPart
(
self
::
AREA_TEST
,
self
::
AREA_PART_EVENTS
);
$this
->
loadAreaPart
(
self
::
AREA_TEST
,
self
::
AREA_PART_EVENTS
);
$this
->
replaceRegistry
(
self
::
REGISTRY_PATH_SHARED_STORAGE
,
new
Varien_Object
());
return
$this
;
return
$this
;
}
}
/**
* Sets cache options for test case
*
* @param array $options
* @return EcomDev_PHPUnit_Model_App
*/
public
function
setCacheOptions
(
array
$options
)
{
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
$this
->
_cache
,
'_allowedCacheOptions'
,
$options
);
}
/**
* Retrieve cache options for test case
*
* @return array
*/
public
function
getCacheOptions
()
{
return
EcomDev_Utils_Reflection
::
getRestrictedPropertyValue
(
$this
->
_cache
,
'_allowedCacheOptions'
);
}
/**
/**
* Retrieves a model from config and checks it on interface implementation
* Retrieves a model from config and checks it on interface implementation
*
*
...
@@ -362,7 +390,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
...
@@ -362,7 +390,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
/**
/**
* Returns class name from configuration path,
* Returns class name from configuration path,
* If $interface is specified, then it additionaly checks it for implementation
* If $interface is specified, then it additional
l
y checks it for implementation
*
*
*
*
* @param string $configPath
* @param string $configPath
...
@@ -504,7 +532,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
...
@@ -504,7 +532,7 @@ class EcomDev_PHPUnit_Model_App extends Mage_Core_Model_App
/**
/**
* Overriden for disabling events
* Overriden for disabling events
* fire during fix
ut
re loading
* fire during fix
tu
re loading
*
*
* (non-PHPdoc)
* (non-PHPdoc)
* @see Mage_Core_Model_App::dispatchEvent()
* @see Mage_Core_Model_App::dispatchEvent()
...
...
app/code/community/EcomDev/PHPUnit/Model/App/Area.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -37,6 +37,7 @@ class EcomDev_PHPUnit_Model_App_Area
...
@@ -37,6 +37,7 @@ class EcomDev_PHPUnit_Model_App_Area
*/
*/
public
function
reset
()
public
function
reset
()
{
{
$this
->
_loadedParts
=
array
();
$this
->
resetEvents
();
$this
->
resetEvents
();
$this
->
resetDesign
();
$this
->
resetDesign
();
$this
->
resetTranslate
();
$this
->
resetTranslate
();
...
...
app/code/community/EcomDev/PHPUnit/Model/Config.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -28,12 +28,18 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
...
@@ -28,12 +28,18 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
const
CHANGE_ME
=
'[change me]'
;
const
CHANGE_ME
=
'[change me]'
;
/**
/**
* Scope snapshot without applied configurations,
* Scope snapshot with different levels of saving configuration
* It is used for proper store/website/default loading on per store basis
*
*
* @var Mage_Core_Model_Config_Base
* @var Mage_Core_Model_Config_Base
*/
*/
protected
$_scopeSnapshot
=
null
;
protected
$_scopeSnapshot
=
array
();
/**
* Scope snapshot for a particular test case
*
* @var Mage_Core_Model_Config_Base
*/
protected
$_localScopeSnapshot
=
null
;
/**
/**
* List of replaced instance creation
* List of replaced instance creation
...
@@ -51,7 +57,7 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
...
@@ -51,7 +57,7 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
{
{
if
(
$this
->
_isLocalConfigLoaded
if
(
$this
->
_isLocalConfigLoaded
&&
Mage
::
isInstalled
()
&&
Mage
::
isInstalled
()
&&
$this
->
_scopeSnapshot
===
null
)
{
&&
empty
(
$this
->
_scopeSnapshot
)
)
{
$this
->
saveScopeSnapshot
();
$this
->
saveScopeSnapshot
();
}
}
parent
::
loadDb
();
parent
::
loadDb
();
...
@@ -141,19 +147,27 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
...
@@ -141,19 +147,27 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
*/
*/
public
function
loadScopeSnapshot
()
public
function
loadScopeSnapshot
()
{
{
if
(
$this
->
_scopeSnapshot
===
null
)
{
if
(
empty
(
$this
->
_scopeSnapshot
)
)
{
throw
new
RuntimeException
(
'Cannot load scope snapshot, because it was not saved before'
);
throw
new
RuntimeException
(
'Cannot load scope snapshot, because it was not saved before'
);
}
}
$scopeNode
=
$this
->
_scopeSnapshot
->
getNode
();
$scope
=
clone
end
(
$this
->
_scopeSnapshot
);
foreach
(
$scopeNode
->
children
()
as
$nodeName
=>
$values
)
{
// Remove somehow modified before xml node
$this
->
_xml
=
$scope
;
unset
(
$this
->
getNode
()
->
$nodeName
);
return
$this
;
// Add saved snapshot of configuration node
$this
->
getNode
()
->
addChild
(
$nodeName
);
$this
->
getNode
()
->
$nodeName
->
extend
(
$values
);
}
}
/**
* Flushes current scope snapshot level if it is not the last one
*
* @return EcomDev_PHPUnit_Model_Config
*/
public
function
flushScopeSnapshot
()
{
if
(
count
(
$this
->
_scopeSnapshot
)
>
1
)
{
array_pop
(
$this
->
_scopeSnapshot
);
memory_get_usage
();
// Memory GC
}
return
$this
;
return
$this
;
}
}
...
@@ -161,23 +175,11 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
...
@@ -161,23 +175,11 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
* Saves current configuration snapshot,
* Saves current configuration snapshot,
* for pussible restoring in feature
* for pussible restoring in feature
*
*
* @param array $nodesToSave list of nodes for saving data, by default it is 'default', 'webistes', 'stores'
* @return EcomDev_PHPUnit_Model_Config
* @return EcomDev_PHPUnit_Model_Config
*/
*/
public
function
saveScopeSnapshot
(
$nodesToSave
=
array
(
'default'
,
'websites'
,
'stores'
)
)
public
function
saveScopeSnapshot
()
{
{
$this
->
_scopeSnapshot
=
clone
$this
->
_prototype
;
$this
->
_scopeSnapshot
[]
=
clone
$this
->
_xml
;
$this
->
_scopeSnapshot
->
loadString
(
'<config />'
);
$scopeNode
=
$this
->
_scopeSnapshot
->
getNode
();
foreach
(
$nodesToSave
as
$node
)
{
$scopeNode
->
addChild
(
$node
);
$scopeNode
->
{
$node
}
->
extend
(
$this
->
getNode
(
$node
),
true
);
}
return
$this
;
return
$this
;
}
}
...
@@ -277,7 +279,7 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
...
@@ -277,7 +279,7 @@ class EcomDev_PHPUnit_Model_Config extends Mage_Core_Model_Config
echo
sprintf
(
echo
sprintf
(
'Please change values in %s file for nodes %s and %s. '
'Please change values in %s file for nodes %s and %s. '
.
'It will help in setting up proper controller test cases'
,
.
'It will help in setting up proper controller test cases'
,
'app/etc/local.phpunit'
,
self
::
XML_PATH_SECURE_BASE_URL
,
self
::
XML_PATH_UNSECURE_BASE_URL
'app/etc/local.
xml.
phpunit'
,
self
::
XML_PATH_SECURE_BASE_URL
,
self
::
XML_PATH_UNSECURE_BASE_URL
);
);
exit
();
exit
();
}
}
...
...
app/code/community/EcomDev/PHPUnit/Model/Design/Package.php
View file @
d7fb0f16
...
@@ -30,6 +30,11 @@ class EcomDev_PHPUnit_Model_Design_Package
...
@@ -30,6 +30,11 @@ class EcomDev_PHPUnit_Model_Design_Package
$this
->
setPackageName
(
$designPackage
);
$this
->
setPackageName
(
$designPackage
);
$this
->
setTheme
(
$theme
);
$this
->
setTheme
(
$theme
);
$params
=
array
(
'_area'
=>
$area
,
'_package'
=>
$designPackage
,
'_theme'
=>
$theme
,
);
$actualFileName
=
$this
->
getLayoutFilename
(
$fileName
,
$params
);
$actualFileName
=
$this
->
getLayoutFilename
(
$fileName
,
$params
);
if
(
$theme
!==
null
||
$designPackage
!==
null
)
{
if
(
$theme
!==
null
||
$designPackage
!==
null
)
{
...
@@ -41,7 +46,7 @@ class EcomDev_PHPUnit_Model_Design_Package
...
@@ -41,7 +46,7 @@ class EcomDev_PHPUnit_Model_Design_Package
'_package'
=>
$expectedDesignPackage
'_package'
=>
$expectedDesignPackage
);
);
$expectedFileName
=
Mage
::
getBaseDir
(
'design'
)
.
DS
.
$this
->
_renderFilename
(
$fileName
,
$params
);
$expectedFileName
=
$this
->
_renderFilename
(
$fileName
,
$params
);
}
else
{
}
else
{
$expectedFileName
=
$actualFileName
;
$expectedFileName
=
$actualFileName
;
if
(
!
file_exists
(
$actualFileName
))
{
if
(
!
file_exists
(
$actualFileName
))
{
...
...
app/code/community/EcomDev/PHPUnit/Model/Expectation/Interface.php
View file @
d7fb0f16
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Model/Expectation/Object.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
View file @
d7fb0f16
This diff is collapsed.
Click to expand it.
app/code/community/EcomDev/PHPUnit/Model/Fixture/Interface.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -25,6 +25,9 @@
...
@@ -25,6 +25,9 @@
*/
*/
interface
EcomDev_PHPUnit_Model_Fixture_Interface
extends
EcomDev_PHPUnit_Model_Test_Loadable_Interface
interface
EcomDev_PHPUnit_Model_Fixture_Interface
extends
EcomDev_PHPUnit_Model_Test_Loadable_Interface
{
{
const
SCOPE_LOCAL
=
'local'
;
const
SCOPE_SHARED
=
'shared'
;
/**
/**
* Sets fixture options
* Sets fixture options
*
*
...
@@ -32,4 +35,74 @@ interface EcomDev_PHPUnit_Model_Fixture_Interface extends EcomDev_PHPUnit_Model_
...
@@ -32,4 +35,74 @@ interface EcomDev_PHPUnit_Model_Fixture_Interface extends EcomDev_PHPUnit_Model_
* @return EcomDev_PHPUnit_Model_Fixture_Interface
* @return EcomDev_PHPUnit_Model_Fixture_Interface
*/
*/
public
function
setOptions
(
array
$options
);
public
function
setOptions
(
array
$options
);
/**
* Sets storage for fixtures
*
* @param Varien_Object $storage
* @return EcomDev_PHPUnit_Model_Fixture_Interface
*/
public
function
setStorage
(
Varien_Object
$storage
);
/**
* Retrieve fixture storage
*
* @return Varien_Object
*/
public
function
getStorage
();
/**
* Retrieves storage data for a particular fixture scope
*
* @param string $key
* @param string|null $scope
*/
public
function
getStorageData
(
$key
,
$scope
=
null
);
/**
* Sets storage data for a particular fixture scope
*
* @param string $key
* @param mixed $value
* @param string|null $scope
*/
public
function
setStorageData
(
$key
,
$value
,
$scope
=
null
);
/**
* Returns current fixture scope
*
* @return string
*/
public
function
getScope
();
/**
* Sets current fixture scope
*
*
* @param string $scope EcomDev_PHPUnit_Model_Fixture_Interface::SCOPE_LOCAL|EcomDev_PHPUnit_Model_Fixture_Interface::SCOPE_SHARED
*/
public
function
setScope
(
$scope
);
/**
* Check that current fixture scope is equal to SCOPE_SHARED
*
* @return boolean
*/
public
function
isScopeShared
();
/**
* Check that current fixture scope is equal to SCOPE_LOCAL
*
* @return boolean
*/
public
function
isScopeLocal
();
/**
* Loads fixture files from test class annotations
*
* @param string $className
* @return EcomDev_PHPUnit_Model_Fixture_Interface
*/
public
function
loadForClass
(
$className
);
}
}
app/code/community/EcomDev/PHPUnit/Model/Layout.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -37,8 +37,15 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
...
@@ -37,8 +37,15 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
*/
*/
public
function
cleanTable
(
$tableEntity
)
public
function
cleanTable
(
$tableEntity
)
{
{
try
{
$this
->
_getWriteAdapter
()
$this
->
_getWriteAdapter
()
->
truncate
(
$this
->
getTable
(
$tableEntity
));
->
delete
(
$this
->
getTable
(
$tableEntity
));
}
catch
(
Exception
$e
)
{
throw
new
EcomDev_PHPUnit_Model_Mysql4_Fixture_Exception
(
sprintf
(
'Unable to clear records for a table "%s"'
,
$tableEntity
),
$e
);
}
return
$this
;
return
$this
;
}
}
...
@@ -58,10 +65,17 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
...
@@ -58,10 +65,17 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
$records
[]
=
$this
->
_getTableRecord
(
$row
,
$tableColumns
);
$records
[]
=
$this
->
_getTableRecord
(
$row
,
$tableColumns
);
}
}
$this
->
_getWriteAdapter
()
->
insertMultiple
(
try
{
$this
->
_getWriteAdapter
()
->
insertOnDuplicate
(
$this
->
getTable
(
$tableEntity
),
$this
->
getTable
(
$tableEntity
),
$records
$records
);
);
}
catch
(
Exception
$e
)
{
throw
new
EcomDev_PHPUnit_Model_Mysql4_Fixture_Exception
(
sprintf
(
'Unable to insert/update records for a table "%s"'
,
$tableEntity
),
$e
);
}
return
$this
;
return
$this
;
}
}
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Abstract.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -36,6 +36,13 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
...
@@ -36,6 +36,13 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
*/
*/
protected
$_options
=
array
();
protected
$_options
=
array
();
/**
* Fixture model
*
* @var EcomDev_PHPUnit_Model_Fixture_Interface
*/
protected
$_fixture
=
null
;
/**
/**
* Retrieve required indexers for re-building
* Retrieve required indexers for re-building
*
*
...
@@ -46,6 +53,17 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
...
@@ -46,6 +53,17 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
return
$this
->
_requiredIndexers
;
return
$this
->
_requiredIndexers
;
}
}
/**
* Sets fixture model to EAV loader
*
* @param EcomDev_PHPUnit_Model_Fixture_Interface $fixture
*/
public
function
setFixture
(
$fixture
)
{
$this
->
_fixture
=
$fixture
;
return
$this
;
}
/**
/**
* Set fixture options
* Set fixture options
*
*
...
@@ -95,8 +113,19 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
...
@@ -95,8 +113,19 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
*/
*/
public
function
loadEntity
(
$entityType
,
$values
)
public
function
loadEntity
(
$entityType
,
$values
)
{
{
$originalRequiredIndexers
=
$this
->
_requiredIndexers
;
if
(
!
empty
(
$this
->
_options
[
'addRequiredIndex'
]))
{
foreach
(
$this
->
_options
[
'addRequiredIndex'
]
as
$data
)
{
if
(
preg_match
(
'/^([a-z0-9_\\-])+\\s+([a-z0-9_\\-])\s*$/i'
,
$data
,
$match
)
&&
$match
[
1
]
==
$entityType
)
{
$this
->
_requiredIndexers
[]
=
$match
[
2
];
}
}
}
$entityTypeModel
=
Mage
::
getSingleton
(
'eav/config'
)
->
getEntityType
(
$entityType
);
$entityTypeModel
=
Mage
::
getSingleton
(
'eav/config'
)
->
getEntityType
(
$entityType
);
$entityTableColumns
=
$this
->
_getWriteAdapter
()
->
describeTable
(
$entityTableColumns
=
$this
->
_getWriteAdapter
()
->
describeTable
(
$this
->
getTable
(
$entityTypeModel
->
getEntityTable
())
$this
->
getTable
(
$entityTypeModel
->
getEntityTable
())
);
);
...
@@ -119,7 +148,7 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
...
@@ -119,7 +148,7 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
throw
new
RuntimeException
(
'Entity Id should be specified in EAV fixture'
);
throw
new
RuntimeException
(
'Entity Id should be specified in EAV fixture'
);
}
}
// Ful
lfil nec
cessary information
// Ful
fill ne
cessary information
$row
[
'entity_type_id'
]
=
$entityTypeModel
->
getEntityTypeId
();
$row
[
'entity_type_id'
]
=
$entityTypeModel
->
getEntityTypeId
();
if
(
!
isset
(
$row
[
'attribute_set_id'
]))
{
if
(
!
isset
(
$row
[
'attribute_set_id'
]))
{
$row
[
'attribute_set_id'
]
=
$entityTypeModel
->
getDefaultAttributeSetId
();
$row
[
'attribute_set_id'
]
=
$entityTypeModel
->
getDefaultAttributeSetId
();
...
@@ -197,6 +226,8 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
...
@@ -197,6 +226,8 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
}
}
}
}
// Restoring original required indexers for making tests isolated
$this
->
_requiredIndexers
=
$originalRequiredIndexers
;
return
$this
;
return
$this
;
}
}
...
@@ -325,9 +356,35 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
...
@@ -325,9 +356,35 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract extends EcomDev
$value
=
null
;
$value
=
null
;
}
}
if
(
$attribute
->
usesSource
()
&&
$value
!==
null
)
{
if
(
$attribute
->
getSource
()
instanceof
Mage_Eav_Model_Entity_Attribute_Source_Abstract
)
{
$value
=
$attribute
->
getSource
()
->
getOptionId
(
$value
);
}
else
{
$value
=
$this
->
_getOptionIdNonAttributeSource
(
$attribute
->
getSource
()
->
getAllOptions
(),
$value
);
}
}
return
$value
;
return
$value
;
}
}
/**
* Get option id if attribute source model doesn't support eav attribute interface
*
*
* @param array $options
* @param mixed $value
*/
protected
function
_getOptionIdNonAttributeSource
(
$options
,
$value
)
{
foreach
(
$options
as
$option
)
{
if
(
strcasecmp
(
$option
[
'label'
],
$value
)
==
0
||
$option
[
'value'
]
==
$value
)
{
return
$option
[
'value'
];
}
}
return
null
;
}
/**
/**
* Retrieves entity id field, based on entity configuration
* Retrieves entity id field, based on entity configuration
*
*
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Abstract.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -120,7 +120,9 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Abstract extends
...
@@ -120,7 +120,9 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Abstract extends
*/
*/
protected
function
_getGwsValue
(
$row
,
$attribute
,
$scopeCode
,
$scopeType
=
self
::
SCOPE_TYPE_STORE
)
protected
function
_getGwsValue
(
$row
,
$attribute
,
$scopeCode
,
$scopeType
=
self
::
SCOPE_TYPE_STORE
)
{
{
if
(
!
isset
(
$row
[
'/'
.
$scopeType
][
$scopeCode
])
||
!
is_array
(
$row
[
'/'
.
$scopeType
][
$scopeCode
]))
{
if
(
!
isset
(
$row
[
'/'
.
$scopeType
][
$scopeCode
])
||
!
is_array
(
$row
[
'/'
.
$scopeType
][
$scopeCode
])
||
!
isset
(
$row
[
'/'
.
$scopeType
][
$scopeCode
][
$attribute
->
getAttributeCode
()]))
{
return
null
;
return
null
;
}
}
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Category.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Product.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -25,14 +25,13 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
...
@@ -25,14 +25,13 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
{
{
protected
$_requiredIndexers
=
array
(
protected
$_requiredIndexers
=
array
(
'cataloginventory_stock'
,
'cataloginventory_stock'
,
'catalog_product_flat'
,
'catalog_product_attribute'
,
'catalog_product_attribute'
,
'catalog_product_price'
'catalog_product_price'
);
);
/**
/**
* Ov
veri
den to fix issue with flat tables existance mark
* Ov
errid
den to fix issue with flat tables existance mark
* (non-PHPdoc)
* (non-PHPdoc)
* @see EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract::loadEntity()
* @see EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract::loadEntity()
*/
*/
...
@@ -49,7 +48,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
...
@@ -49,7 +48,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
}
}
/**
/**
* Overriden to add easy fixture loading for websites and categories associations
* Overrid
d
en to add easy fixture loading for websites and categories associations
* (non-PHPdoc)
* (non-PHPdoc)
* @see EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract::_getCustomTableRecords()
* @see EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract::_getCustomTableRecords()
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Default.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Exception.php
0 → 100644
View file @
d7fb0f16
<?php
class
EcomDev_PHPUnit_Model_Mysql4_Fixture_Exception
extends
RuntimeException
{
public
function
__construct
(
$message
,
Exception
$previous
)
{
parent
::
__construct
(
$message
,
0
,
$previous
);
}
}
\ No newline at end of file
app/code/community/EcomDev/PHPUnit/Model/Test/Loadable/Interface.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
app/code/community/EcomDev/PHPUnit/Test/Case.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -75,8 +75,8 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -75,8 +75,8 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
public
static
function
assertEventDispatched
(
$eventName
)
public
static
function
assertEventDispatched
(
$eventName
)
{
{
if
(
is_array
(
$eventName
))
{
if
(
is_array
(
$eventName
))
{
foreach
(
$eventName
s
as
$e
ventName
)
{
foreach
(
$eventName
as
$singleE
ventName
)
{
self
::
assertEventDispatched
(
$
e
ventName
);
self
::
assertEventDispatched
(
$
singleE
ventName
);
}
}
return
;
return
;
}
}
...
@@ -95,8 +95,8 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -95,8 +95,8 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
public
static
function
assertEventNotDispatched
(
$eventName
)
public
static
function
assertEventNotDispatched
(
$eventName
)
{
{
if
(
is_array
(
$eventName
))
{
if
(
is_array
(
$eventName
))
{
foreach
(
$eventName
s
as
$e
ventName
)
{
foreach
(
$eventName
as
$singleE
ventName
)
{
self
::
assertEventNotDispatched
(
$
e
ventName
);
self
::
assertEventNotDispatched
(
$
singleE
ventName
);
}
}
return
;
return
;
}
}
...
@@ -271,12 +271,28 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -271,12 +271,28 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
* @return array
* @return array
*/
*/
public
function
getAnnotationByName
(
$name
,
$sources
=
'method'
)
public
function
getAnnotationByName
(
$name
,
$sources
=
'method'
)
{
return
self
::
getAnnotationByNameFromClass
(
get_class
(
$this
),
$name
,
$sources
,
$this
->
getName
(
false
));
}
/**
* Retrieves annotation by its name from different sources (class, method) based on meta information
*
* @param string $className
* @param string $name annotation name
* @param array|string $sources
* @param string $testName test method name
*/
public
static
function
getAnnotationByNameFromClass
(
$className
,
$name
,
$sources
=
'class'
,
$testName
=
''
)
{
{
if
(
is_string
(
$sources
))
{
if
(
is_string
(
$sources
))
{
$sources
=
array
(
$sources
);
$sources
=
array
(
$sources
);
}
}
$allAnnotations
=
$this
->
getAnnotations
();
$allAnnotations
=
PHPUnit_Util_Test
::
parseTestMethodAnnotations
(
$className
,
$testName
);
$annotation
=
array
();
$annotation
=
array
();
// Walkthrough sources for annotation retrieval
// Walkthrough sources for annotation retrieval
...
@@ -627,12 +643,30 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -627,12 +643,30 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
*
*
* @return EcomDev_PHPUnit_Model_Fixture
* @return EcomDev_PHPUnit_Model_Fixture
*/
*/
protected
function
getFixture
()
protected
static
function
getFixture
()
{
{
return
Mage
::
getSingleton
(
$this
->
getLoadableClassAlias
(
$fixture
=
Mage
::
getSingleton
(
self
::
getLoadableClassAlias
(
'fixture'
,
'fixture'
,
self
::
XML_PATH_DEFAULT_FIXTURE_MODEL
self
::
XML_PATH_DEFAULT_FIXTURE_MODEL
));;
)
);
if
(
!
$fixture
instanceof
EcomDev_PHPUnit_Model_Fixture_Interface
)
{
throw
new
RuntimeException
(
'Fixture model should implement EcomDev_PHPUnit_Model_Fixture_Interface interface'
);
}
$storage
=
Mage
::
registry
(
EcomDev_PHPUnit_Model_App
::
REGISTRY_PATH_SHARED_STORAGE
);
if
(
!
$storage
instanceof
Varien_Object
)
{
throw
new
RuntimeException
(
'Fixture storage object was not initialized during test application setup'
);
}
$fixture
->
setStorage
(
Mage
::
registry
(
EcomDev_PHPUnit_Model_App
::
REGISTRY_PATH_SHARED_STORAGE
)
);
return
$fixture
;
}
}
/**
/**
...
@@ -642,10 +676,12 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -642,10 +676,12 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
*/
*/
protected
function
getExpectation
()
protected
function
getExpectation
()
{
{
return
Mage
::
getSingleton
(
$this
->
getLoadableClassAlias
(
return
Mage
::
getSingleton
(
self
::
getLoadableClassAlias
(
'expectation'
,
'expectation'
,
self
::
XML_PATH_DEFAULT_EXPECTATION_MODEL
self
::
XML_PATH_DEFAULT_EXPECTATION_MODEL
));
)
);
}
}
...
@@ -655,15 +691,19 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -655,15 +691,19 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
*
*
* @param string $type
* @param string $type
* @param string $configPath
* @param string $configPath
* @return string
*/
*/
protected
function
getLoadableClassAlias
(
$type
,
$configPath
)
protected
static
function
getLoadableClassAlias
(
$type
,
$configPath
)
{
{
$annotationValue
=
$this
->
getAnnotationByName
(
$type
.
'Model'
,
'class'
);
$annotationValue
=
self
::
getAnnotationByNameFromClass
(
get_called_class
(),
$type
.
'Model'
);
if
(
current
(
$annotationValue
))
{
if
(
current
(
$annotationValue
))
{
$classAlias
=
current
(
$annotationValue
);
$classAlias
=
current
(
$annotationValue
);
}
else
{
}
else
{
$classAlias
=
$this
->
app
()
->
getConfig
()
->
getNode
(
$configPath
);
$classAlias
=
self
::
app
()
->
getConfig
()
->
getNode
(
$configPath
);
}
}
return
$classAlias
;
return
$classAlias
;
...
@@ -699,17 +739,45 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -699,17 +739,45 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
$name
=
$this
->
getName
(
false
);
$name
=
$this
->
getName
(
false
);
}
}
return
self
::
getYamlFilePathByClass
(
get_called_class
(),
$type
,
$name
);
}
/**
* Loads YAML file from directory inside of the unit test class or
* the directory inside the module directory if name is prefixed with ~/
* or from another module if name is prefixed with ~My_Module/
*
* @param string $className class name for looking fixture files
* @param string $type type of YAML data (fixtures,expectations,dataproviders)
* @param string $name the file name for loading
* @return string|boolean
*/
public
static
function
getYamlFilePathByClass
(
$className
,
$type
,
$name
)
{
if
(
strrpos
(
$name
,
'.yaml'
)
!==
strlen
(
$name
)
-
5
)
{
if
(
strrpos
(
$name
,
'.yaml'
)
!==
strlen
(
$name
)
-
5
)
{
$name
.=
'.yaml'
;
$name
.=
'.yaml'
;
}
}
$classFileObject
=
new
SplFileInfo
(
$classFileObject
=
new
SplFileInfo
(
EcomDev_Utils_Reflection
::
getRelflection
(
$
this
)
->
getFileName
()
EcomDev_Utils_Reflection
::
getRelflection
(
$
className
)
->
getFileName
()
);
);
// When prefixed with ~/ or ~My_Module/, load from the module's Test/<type> directory
if
(
preg_match
(
'#^~(?<module>[^/]*)/(?<path>.*)$#'
,
$name
,
$matches
))
{
$name
=
$matches
[
'path'
];
if
(
!
empty
(
$matches
[
'module'
]))
{
$moduleName
=
$matches
[
'module'
];
}
else
{
$moduleName
=
substr
(
$className
,
0
,
strpos
(
$className
,
'_Test_'
));;
}
$filePath
=
Mage
::
getModuleDir
(
''
,
$moduleName
)
.
DS
.
'Test'
.
DS
;
}
// Otherwise load from the Class/<type> directory
else
{
$filePath
=
$classFileObject
->
getPath
()
.
DS
$filePath
=
$classFileObject
->
getPath
()
.
DS
.
$classFileObject
->
getBasename
(
'.php'
)
.
DS
.
$classFileObject
->
getBasename
(
'.php'
)
.
DS
;
.
$type
.
DS
.
$name
;
}
$filePath
.=
$type
.
DS
.
$name
;
if
(
file_exists
(
$filePath
))
{
if
(
file_exists
(
$filePath
))
{
return
$filePath
;
return
$filePath
;
...
@@ -726,15 +794,38 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -726,15 +794,38 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
*/
*/
protected
function
setUp
()
protected
function
setUp
()
{
{
$this
->
getFixture
()
->
loadByTestCase
(
$this
);
self
::
getFixture
()
->
setScope
(
EcomDev_PHPUnit_Model_Fixture_Interface
::
SCOPE_LOCAL
)
->
loadByTestCase
(
$this
);
$annotations
=
$this
->
getAnnotations
();
$annotations
=
$this
->
getAnnotations
();
$this
->
getFixture
()
->
setOptions
(
$annotations
[
'method'
]);
self
::
getFixture
()
$this
->
getFixture
()
->
apply
();
->
setOptions
(
$annotations
[
'method'
])
->
apply
();
$this
->
app
()
->
resetDispatchedEvents
();
$this
->
app
()
->
resetDispatchedEvents
();
parent
::
setUp
();
parent
::
setUp
();
}
}
/**
* Initializes test environment for subset of tests
*
*/
public
static
function
setUpBeforeClass
()
{
self
::
getFixture
()
->
setScope
(
EcomDev_PHPUnit_Model_Fixture_Interface
::
SCOPE_SHARED
)
->
loadForClass
(
get_called_class
());
$annotations
=
PHPUnit_Util_Test
::
parseTestMethodAnnotations
(
get_called_class
()
);
self
::
getFixture
()
->
setOptions
(
$annotations
[
'class'
])
->
apply
();
parent
::
setUpBeforeClass
();
}
/**
/**
* Implements default data provider functionality,
* Implements default data provider functionality,
* returns array data loaded from Yaml file with the same name as test method
* returns array data loaded from Yaml file with the same name as test method
...
@@ -796,9 +887,24 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
...
@@ -796,9 +887,24 @@ abstract class EcomDev_PHPUnit_Test_Case extends PHPUnit_Framework_TestCase
$this
->
app
()
->
replaceRegistry
(
$registryPath
,
$originalValue
);
$this
->
app
()
->
replaceRegistry
(
$registryPath
,
$originalValue
);
}
}
$this
->
getFixture
()
->
discard
();
// Clear applied fixture
self
::
getFixture
()
->
setScope
(
EcomDev_PHPUnit_Model_Fixture_Interface
::
SCOPE_LOCAL
)
->
discard
();
// Clear applied fixture
parent
::
tearDown
();
parent
::
tearDown
();
}
}
/**
* Clean up all the shared fixture data
*
* @return void
*/
public
static
function
tearDownAfterClass
()
{
self
::
getFixture
()
->
setScope
(
EcomDev_PHPUnit_Model_Fixture_Interface
::
SCOPE_SHARED
)
->
discard
();
parent
::
tearDownAfterClass
();
}
}
}
app/code/community/EcomDev/PHPUnit/Test/Case/Config.php
View file @
d7fb0f16
This diff is collapsed.
Click to expand it.
app/code/community/EcomDev/PHPUnit/Test/Case/Controller.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -431,7 +431,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Controller extends EcomDev_PHPUnit_Test
...
@@ -431,7 +431,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Controller extends EcomDev_PHPUnit_Test
{
{
self
::
assertRequestNot
(
self
::
assertRequestNot
(
EcomDev_PHPUnit_Constraint_Controller_Request
::
TYPE_BEFORE_FORWARD_ROUTE
,
EcomDev_PHPUnit_Constraint_Controller_Request
::
TYPE_BEFORE_FORWARD_ROUTE
,
$expected
ActionNam
e
,
$message
$expected
BeforeForwardedRout
e
,
$message
);
);
}
}
...
@@ -1969,7 +1969,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Controller extends EcomDev_PHPUnit_Test
...
@@ -1969,7 +1969,7 @@ abstract class EcomDev_PHPUnit_Test_Case_Controller extends EcomDev_PHPUnit_Test
// Workaround for form key
// Workaround for form key
if
(
$this
->
getRequest
()
->
isPost
())
{
if
(
$this
->
getRequest
()
->
isPost
())
{
$this
->
getRequest
()
->
setPost
(
'form_key'
,
Mage
::
getSingleton
(
'core/session'
)
->
getF
ro
mKey
());
$this
->
getRequest
()
->
setPost
(
'form_key'
,
Mage
::
getSingleton
(
'core/session'
)
->
getF
or
mKey
());
}
}
$this
->
getLayout
()
->
reset
();
$this
->
getLayout
()
->
reset
();
...
...
app/code/community/EcomDev/PHPUnit/Test/Suite.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -145,7 +145,7 @@ class EcomDev_PHPUnit_Test_Suite extends PHPUnit_Framework_TestSuite
...
@@ -145,7 +145,7 @@ class EcomDev_PHPUnit_Test_Suite extends PHPUnit_Framework_TestSuite
foreach
(
$directoryIterator
as
$fileObject
)
{
foreach
(
$directoryIterator
as
$fileObject
)
{
/* @var $fileObject SplFileObject */
/* @var $fileObject SplFileObject */
// Skip entry if it is not a php file
// Skip entry if it is not a php file
if
(
!
$fileObject
->
isFile
(
)
||
$fileObject
->
getBasename
(
'.php'
)
===
$fileObject
->
getBasename
())
{
if
(
(
!
$fileObject
->
isFile
()
&&
!
$fileObject
->
isLink
()
)
||
$fileObject
->
getBasename
(
'.php'
)
===
$fileObject
->
getBasename
())
{
continue
;
continue
;
}
}
...
...
app/code/community/EcomDev/PHPUnit/Test/Suite/Group.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -25,13 +25,19 @@ class EcomDev_PHPUnit_Test_Suite_Group extends PHPUnit_Framework_TestSuite
...
@@ -25,13 +25,19 @@ class EcomDev_PHPUnit_Test_Suite_Group extends PHPUnit_Framework_TestSuite
{
{
const
NO_GROUP_KEYWORD
=
'__nogroup__'
;
const
NO_GROUP_KEYWORD
=
'__nogroup__'
;
/**
* Name of suite that will be printed in tap/testdox format
*
* @var string
*/
protected
$suiteName
=
null
;
/**
/**
* Contructor adds test groups defined on global level
* Contructor adds test groups defined on global level
* and adds additional logic for test names retrieval
* and adds additional logic for test names retrieval
*
*
* (non-PHPdoc)
* (non-PHPdoc)
* @see PHPUnit_Framework_TestSuite::__construct()
* @see PHPUnit_Framework_TestSuite::__construct()
* @param array $groups
*/
*/
public
function
__construct
(
$theClass
=
''
,
$groups
=
array
())
public
function
__construct
(
$theClass
=
''
,
$groups
=
array
())
{
{
...
@@ -44,14 +50,12 @@ class EcomDev_PHPUnit_Test_Suite_Group extends PHPUnit_Framework_TestSuite
...
@@ -44,14 +50,12 @@ class EcomDev_PHPUnit_Test_Suite_Group extends PHPUnit_Framework_TestSuite
$theClass
->
getName
()
$theClass
->
getName
()
);
);
if
(
isset
(
$annotation
[
'name'
]))
{
if
(
isset
(
$annotations
[
'name'
]))
{
$name
=
$annotations
[
'name'
];
$this
->
suiteName
=
$annotations
[
'name'
];
}
else
{
$name
=
sprintf
(
'Test suite for %s'
,
$theClass
->
getName
());
}
}
// Creates all test instances
// Creates all test instances
parent
::
__construct
(
$theClass
,
$name
);
parent
::
__construct
(
$theClass
);
// Just sort-out them by our internal groups
// Just sort-out them by our internal groups
foreach
(
$groups
as
$group
)
{
foreach
(
$groups
as
$group
)
{
...
@@ -81,4 +85,15 @@ class EcomDev_PHPUnit_Test_Suite_Group extends PHPUnit_Framework_TestSuite
...
@@ -81,4 +85,15 @@ class EcomDev_PHPUnit_Test_Suite_Group extends PHPUnit_Framework_TestSuite
unset
(
$this
->
groups
[
self
::
NO_GROUP_KEYWORD
]);
unset
(
$this
->
groups
[
self
::
NO_GROUP_KEYWORD
]);
}
}
}
}
/**
* Outputs test suite name from annotations
*
* (non-PHPdoc)
* @see PHPUnit_Framework_TestSuite::toString()
*/
public
function
toString
()
{
return
$this
->
suiteName
!==
null
?
$this
->
suiteName
:
$this
->
name
;
}
}
}
app/code/community/EcomDev/PHPUnit/etc/config.xml
View file @
d7fb0f16
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Abstract.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
* Abstract constraint for EcomDev_PHPUnit constraints
* Abstract constraint for EcomDev_PHPUnit constraints
* Contains flexible constaint types implementation
* Contains flexible constaint types implementation
*
*
* @todo refactor failures for being 100% compatible with PHPUnit 3.6
*/
*/
abstract
class
EcomDev_PHPUnit_Constraint_Abstract
abstract
class
EcomDev_PHPUnit_Constraint_Abstract
extends
PHPUnit_Framework_Constraint
extends
PHPUnit_Framework_Constraint
...
@@ -109,6 +110,7 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
...
@@ -109,6 +110,7 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
// Type check
// Type check
if
(
isset
(
$this
->
_expectedValueValidation
[
$type
][
1
])
if
(
isset
(
$this
->
_expectedValueValidation
[
$type
][
1
])
&&
$expectedValue
!==
null
&&
!
$this
->
_expectedValueValidation
[
$type
][
1
](
$expectedValue
))
{
&&
!
$this
->
_expectedValueValidation
[
$type
][
1
](
$expectedValue
))
{
throw
PHPUnit_Util_InvalidArgumentHelper
::
factory
(
2
,
$expectedValueType
,
$expectedValue
);
throw
PHPUnit_Util_InvalidArgumentHelper
::
factory
(
2
,
$expectedValueType
,
$expectedValue
);
}
}
...
@@ -148,12 +150,29 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
...
@@ -148,12 +150,29 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
/**
/**
* Evaluates value by type.
* Evaluates value by type.
*
(non-PHPdoc)
*
* @see PHPUnit_Framework_Constraint::evaluate()
* @see PHPUnit_Framework_Constraint::evaluate()
*
* @param mixed $other Value or object to evaluate.
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
* @return mixed
*/
*/
public
function
evaluate
(
$other
)
public
function
evaluate
(
$other
,
$description
=
''
,
$returnResult
=
false
)
{
{
return
$this
->
callProtectedByType
(
'evaluate'
,
$other
);
$success
=
false
;
if
(
$this
->
callProtectedByType
(
'evaluate'
,
$other
))
{
$success
=
true
;
}
if
(
$returnResult
)
{
return
$success
;
}
if
(
!
$success
)
{
$this
->
fail
(
$other
,
$description
);
}
}
}
/**
/**
...
@@ -169,7 +188,12 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
...
@@ -169,7 +188,12 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
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
(
$failureDescription
,
$failureDescription
,
PHPUnit_Util_Diff
::
diff
(
$this
->
getExpectedValue
(),
$this
->
getActualValue
(
$other
)),
new
PHPUnit_Framework_ComparisonFailure
(
$this
->
getExpectedValue
(),
$this
->
getActualValue
(
$other
),
$this
->
getExpectedValue
(),
$this
->
getActualValue
(
$other
)
),
$description
$description
);
);
}
else
{
}
else
{
...
@@ -179,6 +203,23 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
...
@@ -179,6 +203,23 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
}
}
}
}
/**
* Adds compatibility to PHPUnit 3.6
*
* @param mixed $other
* @param mixed $description (custom description)
* @param boolean $not
* @return string
*/
protected
function
failureDescription
(
$other
,
$description
,
$not
)
{
if
(
method_exists
(
$this
,
'customFailureDescription'
))
{
return
$this
->
customFailureDescription
(
$other
,
$description
,
$not
);
}
return
parent
::
failureDescription
(
$other
,
$description
,
$not
);
}
/**
/**
* Returns a scalar representation of actual value,
* Returns a scalar representation of actual value,
* Returns $other if internal acutal value is not set
* Returns $other if internal acutal value is not set
...
@@ -198,7 +239,7 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
...
@@ -198,7 +239,7 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
/**
/**
* Returns a scalar representation of expected value
* Returns a scalar representation of expected value
*
*
* @return s
tring
* @return s
calar
*/
*/
protected
function
getExpectedValue
()
protected
function
getExpectedValue
()
{
{
...
...
lib/EcomDev/PHPUnit/Constraint/Config.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -92,11 +92,11 @@ class EcomDev_PHPUnit_Constraint_Config extends PHPUnit_Framework_Constraint
...
@@ -92,11 +92,11 @@ class EcomDev_PHPUnit_Constraint_Config extends PHPUnit_Framework_Constraint
* @param Varien_Simplexml_Config $config
* @param Varien_Simplexml_Config $config
* @see PHPUnit_Framework_Constraint::evaluate()
* @see PHPUnit_Framework_Constraint::evaluate()
*/
*/
public
function
evaluate
(
$config
)
public
function
evaluate
(
$config
,
$description
=
''
,
$returnResult
=
false
)
{
{
$nodeValue
=
$this
->
getNodeValue
(
$config
);
$nodeValue
=
$this
->
getNodeValue
(
$config
);
return
$this
->
constraint
->
evaluate
(
$nodeValue
);
return
$this
->
constraint
->
evaluate
(
$nodeValue
,
$description
,
$returnResult
);
}
}
/**
/**
...
...
lib/EcomDev/PHPUnit/Constraint/Config/Abstract.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -65,14 +65,14 @@ abstract class EcomDev_PHPUnit_Constraint_Config_Abstract
...
@@ -65,14 +65,14 @@ abstract class EcomDev_PHPUnit_Constraint_Config_Abstract
* (non-PHPdoc)
* (non-PHPdoc)
* @see EcomDev_PHPUnit_Constraint_Abstract::evaluate()
* @see EcomDev_PHPUnit_Constraint_Abstract::evaluate()
*/
*/
public
function
evaluate
(
$other
)
public
function
evaluate
(
$other
,
$description
=
''
,
$returnResult
=
false
)
{
{
if
(
$other
===
false
)
{
if
(
$other
===
false
)
{
// If node was not found, than evaluation fails
// If node was not found, than evaluation fails
return
false
;
return
false
;
}
}
return
parent
::
evaluate
(
$other
);
return
parent
::
evaluate
(
$other
,
$description
,
$returnResult
);
}
}
...
...
lib/EcomDev/PHPUnit/Constraint/Config/EventObserver.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Config/Interface.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Config/Layout.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -139,7 +139,7 @@ class EcomDev_PHPUnit_Constraint_Config_Layout
...
@@ -139,7 +139,7 @@ class EcomDev_PHPUnit_Constraint_Config_Layout
*
*
* @return string
* @return string
*/
*/
protected
function
textLayoutDefition
()
protected
function
textLayoutDefi
ni
tion
()
{
{
$text
=
sprintf
(
'file "%s" is defined in configuration for %s area'
,
$this
->
_expectedValue
,
$this
->
_area
);
$text
=
sprintf
(
'file "%s" is defined in configuration for %s area'
,
$this
->
_expectedValue
,
$this
->
_area
);
...
@@ -164,7 +164,7 @@ class EcomDev_PHPUnit_Constraint_Config_Layout
...
@@ -164,7 +164,7 @@ class EcomDev_PHPUnit_Constraint_Config_Layout
$this
->
setActualValue
(
$assertion
[
'actual'
]);
$this
->
setActualValue
(
$assertion
[
'actual'
]);
$this
->
_expectedValue
=
$assertion
[
'expected'
];
$this
->
_expectedValue
=
$assertion
[
'expected'
];
return
$this
->
_actualValue
!
==
$this
->
_expectedValue
;
return
$this
->
_actualValue
=
==
$this
->
_expectedValue
;
}
}
/**
/**
...
...
lib/EcomDev/PHPUnit/Constraint/Config/Module.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Config/Node.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Config/Resource.php
0 → 100644
View file @
d7fb0f16
<?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>
*/
/**
* Setup resources configuration constraint
*
*/
class
EcomDev_PHPUnit_Constraint_Config_Resource
extends
EcomDev_PHPUnit_Constraint_Config_Abstract
{
const
XML_PATH_RESOURCES_NODE
=
'global/resources'
;
const
TYPE_SETUP_DEFINED
=
'setup_defined'
;
const
TYPE_SETUP_SCHEME_EXISTS
=
'setup_scheme_exists'
;
const
TYPE_SETUP_DATA_EXISTS
=
'setup_data_exists'
;
/**
* Name of the module for constraint
*
* @var string
*/
protected
$_moduleName
=
null
;
/**
* The module directory for constraint
*
* @var string
*/
protected
$_moduleDirectory
=
null
;
/**
* Constraint for evaluation of module config node
*
* @param string $nodePath
* @param string $type
* @param string $moduleDirectory
* @param mixed $expectedValue
*/
public
function
__construct
(
$moduleName
,
$type
,
$moduleDirectory
=
null
,
$expectedValue
=
null
)
{
$this
->
_expectedValueValidation
+=
array
(
self
::
TYPE_SETUP_DEFINED
=>
array
(
false
,
'is_string'
,
'string'
),
self
::
TYPE_SETUP_SCHEME_EXISTS
=>
array
(
false
,
'is_string'
,
'string'
),
self
::
TYPE_SETUP_DATA_EXISTS
=>
array
(
false
,
'is_string'
,
'string'
),
);
$this
->
_typesWithDiff
[]
=
self
::
TYPE_SETUP_DEFINED
;
$this
->
_typesWithDiff
[]
=
self
::
TYPE_SETUP_SCHEME_EXISTS
;
$this
->
_typesWithDiff
[]
=
self
::
TYPE_SETUP_DATA_EXISTS
;
parent
::
__construct
(
self
::
XML_PATH_RESOURCES_NODE
,
$type
,
$expectedValue
);
$this
->
_moduleName
=
$moduleName
;
$this
->
_moduleDirectory
=
$moduleDirectory
;
if
((
$this
->
_type
===
self
::
TYPE_SETUP_SCHEME_EXISTS
||
$this
->
_type
===
self
::
TYPE_SETUP_DATA_EXISTS
)
&&
!
is_dir
(
$moduleDirectory
))
{
throw
PHPUnit_Util_InvalidArgumentHelper
::
factory
(
3
,
'real directory'
,
$moduleDirectory
);
}
}
/**
* Returns list of module setup resources
*
* @param Varien_Simplexml_Element $xml
* @return array
*/
protected
function
getModuleSetupResources
(
Varien_Simplexml_Element
$xml
)
{
$resourcesForModule
=
array
();
foreach
(
$xml
->
children
()
as
$resourceNode
)
{
if
(
isset
(
$resourceNode
->
setup
->
module
)
&&
(
string
)
$resourceNode
->
setup
->
module
===
$this
->
_moduleName
)
{
$resourcesForModule
[]
=
$resourceNode
->
getName
();
}
}
return
$resourcesForModule
;
}
/**
* Checks definition of expected resource name
*
* @param Varien_Simplexml_Element $other
*/
protected
function
evaluateSetupDefined
(
$other
)
{
$moduleResources
=
$this
->
getModuleSetupResources
(
$other
);
if
(
$this
->
_expectedValue
===
null
)
{
$this
->
_expectedValue
=
empty
(
$moduleResources
)
?
strtolower
(
$this
->
_moduleName
)
.
'_setup'
:
current
(
$moduleResources
);
}
$this
->
setActualValue
(
$moduleResources
);
return
in_array
(
$this
->
_expectedValue
,
$this
->
_actualValue
);
}
/**
* Represents constraint for definition of setup resources
*
* @return string
*/
public
function
textSetupDefined
()
{
return
sprintf
(
'contains resource definition for %s module with %s name'
,
$this
->
_moduleName
,
$this
->
_expectedValue
);
}
/**
* Set actual value for comparison from module sql/data directories
*
* @param string $type
* @return EcomDev_PHPUnit_Constraint_Config_Resource
*/
protected
function
setActualValueFromResourceDirectories
(
$type
=
'sql'
)
{
if
(
!
is_dir
(
$this
->
_moduleDirectory
.
DIRECTORY_SEPARATOR
.
$type
))
{
$this
->
setActualValue
(
array
());
return
$this
;
}
$dirIterator
=
new
DirectoryIterator
(
$this
->
_moduleDirectory
.
DIRECTORY_SEPARATOR
.
$type
);
$resourceDirectories
=
array
();
foreach
(
$dirIterator
as
$entry
)
{
/* @var $entry DirectoryIterator */
if
(
$entry
->
isDir
()
&&
!
$entry
->
isDot
())
{
$resourceDirectories
[]
=
$entry
->
getBasename
();
}
}
$this
->
setActualValue
(
$resourceDirectories
);
return
$this
;
}
/**
* Checks existence and definition of expected resource name schema directory
*
* @param Varien_Simplexml_Element $other
*/
protected
function
evaluateSetupSchemeExists
(
$other
)
{
$moduleResources
=
$this
->
getModuleSetupResources
(
$other
);
if
(
$this
->
_expectedValue
===
null
)
{
$this
->
_expectedValue
=
empty
(
$moduleResources
)
?
strtolower
(
$this
->
_moduleName
)
.
'_setup'
:
current
(
$moduleResources
);
}
$this
->
setActualValueFromResourceDirectories
(
'sql'
);
return
in_array
(
$this
->
_expectedValue
,
$moduleResources
)
&&
in_array
(
$this
->
_expectedValue
,
$this
->
_actualValue
);
}
/**
* Represents constraint for definition of setup resources
*
* @return string
*/
public
function
textSetupSchemeExists
()
{
return
sprintf
(
' schema directory is created for %s module with %s name'
,
$this
->
_moduleName
,
$this
->
_expectedValue
);
}
/**
* Checks existence and definition of expected resource name data directory
*
* @param Varien_Simplexml_Element $other
*/
protected
function
evaluateSetupDataExists
(
$other
)
{
$moduleResources
=
$this
->
getModuleSetupResources
(
$other
);
if
(
$this
->
_expectedValue
===
null
)
{
$this
->
_expectedValue
=
empty
(
$moduleResources
)
?
strtolower
(
$this
->
_moduleName
)
.
'_setup'
:
current
(
$moduleResources
);
}
$this
->
setActualValueFromResourceDirectories
(
'data'
);
return
in_array
(
$this
->
_expectedValue
,
$moduleResources
)
&&
in_array
(
$this
->
_expectedValue
,
$this
->
_actualValue
);
}
/**
* Represents constraint for definition of setup resources
*
* @return string
*/
public
function
textSetupDataExists
()
{
return
sprintf
(
' data directory is created for %s module with %s name'
,
$this
->
_moduleName
,
$this
->
_expectedValue
);
}
/**
* Custom failure description for showing config related errors
* (non-PHPdoc)
* @see PHPUnit_Framework_Constraint::customFailureDescription()
*/
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
return
sprintf
(
'Failed asserting that setup resources %s.'
,
$this
->
toString
()
);
}
}
lib/EcomDev/PHPUnit/Constraint/Config/Resource/Script.php
0 → 100644
View file @
d7fb0f16
This diff is collapsed.
Click to expand it.
lib/EcomDev/PHPUnit/Constraint/Config/TableAlias.php
0 → 100644
View file @
d7fb0f16
<?php
/**
* Table alias constraint
*
*/
class
EcomDev_PHPUnit_Constraint_Config_TableAlias
extends
EcomDev_PHPUnit_Constraint_Config_Abstract
{
const
XML_PATH_MODELS
=
'global/models'
;
const
TYPE_TABLE_ALIAS
=
'table_alias'
;
/**
* Table alias name, e.g. the name of the table within resource
*
* @var string
*/
protected
$_tableAliasName
=
null
;
/**
* Table alias prefix,
* e.g. the prefix for tables of a particular resource model
*
* @var string
*/
protected
$_tableAliasPrefix
=
null
;
/**
* Constraint for evaluation of table alias
*
* @param string $tableAlias
* @param string $expectedTableName
* @param string $type
*/
public
function
__construct
(
$tableAlias
,
$expectedTableName
,
$type
=
self
::
TYPE_TABLE_ALIAS
)
{
if
(
!
strpos
(
$tableAlias
,
'/'
))
{
throw
PHPUnit_Util_InvalidArgumentHelper
::
factory
(
2
,
'table alias'
,
$tableAlias
);
}
list
(
$this
->
_tableAliasPrefix
,
$this
->
_tableAliasName
)
=
explode
(
'/'
,
$tableAlias
,
2
);
$this
->
_expectedValueValidation
+=
array
(
self
::
TYPE_TABLE_ALIAS
=>
array
(
true
,
'is_string'
,
'string'
)
);
$this
->
_typesWithDiff
[]
=
self
::
TYPE_TABLE_ALIAS
;
parent
::
__construct
(
self
::
XML_PATH_MODELS
,
$type
,
$expectedTableName
);
}
/**
* Evaluates table alias is mapped to expected table name
*
* @param Varien_Simplexml_Element $other
* @return boolean
*/
protected
function
evaluateTableAlias
(
$other
)
{
if
(
!
isset
(
$other
->
{
$this
->
_tableAliasPrefix
}))
{
$this
->
setActualValue
(
false
);
return
false
;
}
$modelNode
=
$other
->
{
$this
->
_tableAliasPrefix
};
if
(
!
isset
(
$modelNode
->
entities
)
&&
isset
(
$other
->
{(
string
)
$modelNode
->
resourceModel
}))
{
$modelNode
=
$other
->
{(
string
)
$modelNode
->
resourceModel
};
}
if
(
isset
(
$modelNode
->
entities
->
{
$this
->
_tableAliasName
}
->
table
))
{
$tableName
=
(
string
)
$modelNode
->
entities
->
{
$this
->
_tableAliasName
}
->
table
;
}
else
{
$tableName
=
false
;
}
$this
->
setActualValue
(
$tableName
);
return
$this
->
_actualValue
===
$this
->
_expectedValue
;
}
/**
* Text representation of table alias constaint
*
* @return string
*/
protected
function
textTableAlias
()
{
return
'is mapped to table name'
;
}
/**
* Custom failure description for showing config related errors
* (non-PHPdoc)
* @see PHPUnit_Framework_Constraint::customFailureDescription()
*/
protected
function
customFailureDescription
(
$other
,
$description
,
$not
)
{
return
sprintf
(
'Failed asserting that table alias "%s/%s" %s.'
,
$this
->
_tableAliasPrefix
,
$this
->
_tableAliasName
,
$this
->
toString
()
);
}
}
lib/EcomDev/PHPUnit/Constraint/Controller/Request.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Controller/Response/Abstract.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Controller/Response/Body.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Controller/Response/Header.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Exception.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -27,12 +27,16 @@ class EcomDev_PHPUnit_Constraint_Exception extends PHPUnit_Framework_Expectation
...
@@ -27,12 +27,16 @@ class EcomDev_PHPUnit_Constraint_Exception extends PHPUnit_Framework_Expectation
public
function
__construct
(
$description
,
$diff
=
''
,
$message
=
''
)
public
function
__construct
(
$description
,
$diff
=
''
,
$message
=
''
)
{
{
if
(
!
$diff
instanceof
PHPUnit_Framework_ComparisonFailure
)
{
if
(
!
is_scalar
(
$diff
))
{
if
(
!
is_scalar
(
$diff
))
{
$diff
=
print_r
(
$diff
,
true
);
$diff
=
print_r
(
$diff
,
true
);
}
}
$this
->
diff
=
$diff
;
$this
->
diff
=
$diff
;
parent
::
__construct
(
$description
,
null
,
$message
);
$diff
=
null
;
}
parent
::
__construct
(
$description
,
$diff
);
}
}
public
function
toString
()
public
function
toString
()
...
...
lib/EcomDev/PHPUnit/Constraint/Json.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Layout.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Layout/Abstract.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Layout/Block.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -278,8 +278,6 @@ class EcomDev_PHPUnit_Constraint_Layout_Block extends EcomDev_PHPUnit_Constraint
...
@@ -278,8 +278,6 @@ class EcomDev_PHPUnit_Constraint_Layout_Block extends EcomDev_PHPUnit_Constraint
return
sprintf
(
'block "%s" is an instance of %s'
,
$this
->
_blockName
,
$this
->
_expectedValue
);
return
sprintf
(
'block "%s" is an instance of %s'
,
$this
->
_blockName
,
$this
->
_expectedValue
);
}
}
/**
/**
* Evaluates that layout block is a root level block
* Evaluates that layout block is a root level block
*
*
...
@@ -305,4 +303,29 @@ class EcomDev_PHPUnit_Constraint_Layout_Block extends EcomDev_PHPUnit_Constraint
...
@@ -305,4 +303,29 @@ class EcomDev_PHPUnit_Constraint_Layout_Block extends EcomDev_PHPUnit_Constraint
{
{
return
sprintf
(
'block "%s" is a root level one'
,
$this
->
_blockName
);
return
sprintf
(
'block "%s" is a root level one'
,
$this
->
_blockName
);
}
}
/**
* Evaluates that layout block is a child block of expected one
*
* @param EcomDev_PHPUnit_Constraint_Layout_Logger_Interface $other
* @return boolean
*/
protected
function
evaluateParentName
(
$other
)
{
$this
->
setActualValue
(
$other
->
getBlockParent
(
$this
->
_blockName
)
);
return
$this
->
_actualValue
===
$this
->
_expectedValue
;
}
/**
* Text representation of a root level block assertion
*
* @return string
*/
protected
function
textParentName
()
{
return
sprintf
(
'block "%s" is a child of expected block'
,
$this
->
_blockName
);
}
}
}
lib/EcomDev/PHPUnit/Constraint/Layout/Block/Action.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Layout/Block/Property.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Layout/Handle.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Constraint/Layout/Logger/Interface.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Controller/Request/Interface.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Controller/Response/Interface.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Design/Package/Interface.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/PHPUnit/Isolation/Interface.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
...
lib/EcomDev/Utils/Reflection.php
View file @
d7fb0f16
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* @category EcomDev
* @category EcomDev
* @package EcomDev_PHPUnit
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 201
1 Ecommerce Developers
(http://www.ecomdev.org)
* @copyright Copyright (c) 201
2 EcomDev BV
(http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
*/
...
@@ -44,6 +44,23 @@ class EcomDev_Utils_Reflection
...
@@ -44,6 +44,23 @@ class EcomDev_Utils_Reflection
$reflectionProperty
->
setValue
((
is_string
(
$object
)
?
null
:
$object
),
$value
);
$reflectionProperty
->
setValue
((
is_string
(
$object
)
?
null
:
$object
),
$value
);
}
}
/**
* Sets multiple restricted property values for an object
*
* @param string|object $object class name
* @param array $properties
*/
public
static
function
setRestrictedPropertyValues
(
$object
,
array
$properties
)
{
if
(
version_compare
(
PHP_VERSION
,
'5.3.0'
,
'<'
))
{
throw
new
RuntimeException
(
'For setting of restricted properties via Reflection, PHP version should be 5.3.0 or later'
);
}
foreach
(
$properties
as
$property
=>
$value
)
{
self
::
setRestrictedPropertyValue
(
$object
,
$property
,
$value
);
}
}
/**
/**
* Gets protected or private property value
* Gets protected or private property value
*
*
...
...
modman
View file @
d7fb0f16
# EcomDev_PHPUnit definition
# EcomDev_PHPUnit definition
UnitTests.php UnitTests.php
UnitTests.php UnitTests.php
app/etc/modules/EcomDev_PHPUnit.xml app/etc/modules/EcomDev_PHPUnit.xml
app/etc/modules/EcomDev_PHPUnit.xml app/etc/modules/EcomDev_PHPUnit.xml
app/etc/local.xml.phpunit app/etc/local.xml.phpunit
app/code/community/EcomDev/PHPUnit app/code/community/EcomDev/PHPUnit
app/code/community/EcomDev/PHPUnit app/code/community/EcomDev/PHPUnit
lib/EcomDev/PHPUnit lib/EcomDev/PHPUnit
lib/EcomDev/PHPUnit lib/EcomDev/PHPUnit
lib/EcomDev/Utils lib/EcomDev/Utils
lib/EcomDev/Utils lib/EcomDev/Utils
lib/Spyc lib/Spyc
lib/Spyc lib/Spyc
# Copy local.xml.phpunit if it doesn't already exist
@shell \
LOCALXML=app/etc/local.xml.phpunit; \
if [ ! -f $PROJECT/$LOCALXML ]; then \
cp $MODULE/$LOCALXML $PROJECT/$LOCALXML; \
fi
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