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
235b96d2
Commit
235b96d2
authored
Sep 14, 2013
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #135 from sourcerer-mike/dev-guestSession
Able to start sessions as guest for special methods
parents
29b01c15
50bab46b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
5 deletions
+64
-5
app/code/community/EcomDev/PHPUnit/Test/Case.php
app/code/community/EcomDev/PHPUnit/Test/Case.php
+1
-0
app/code/community/EcomDev/PHPUnit/Test/Case/Helper/Guest.php
...code/community/EcomDev/PHPUnit/Test/Case/Helper/Guest.php
+57
-0
app/code/community/EcomDev/PHPUnit/etc/config.xml
app/code/community/EcomDev/PHPUnit/etc/config.xml
+6
-5
No files found.
app/code/community/EcomDev/PHPUnit/Test/Case.php
View file @
235b96d2
...
@@ -29,6 +29,7 @@ use EcomDev_PHPUnit_Helper as TestHelper;
...
@@ -29,6 +29,7 @@ use EcomDev_PHPUnit_Helper as TestHelper;
* @method EcomDev_PHPUnit_Mock_Proxy mockSession($classAlias, array $methods = array())
* @method EcomDev_PHPUnit_Mock_Proxy mockSession($classAlias, array $methods = array())
* @method EcomDev_PHPUnit_Mock_Proxy adminSession(array $resources = array())
* @method EcomDev_PHPUnit_Mock_Proxy adminSession(array $resources = array())
* @method EcomDev_PHPUnit_Mock_Proxy customerSession(int $customerId)
* @method EcomDev_PHPUnit_Mock_Proxy customerSession(int $customerId)
* @method EcomDev_PHPUnit_Mock_Proxy guestSession()
*/
*/
abstract
class
EcomDev_PHPUnit_Test_Case
extends
PHPUnit_Framework_TestCase
abstract
class
EcomDev_PHPUnit_Test_Case
extends
PHPUnit_Framework_TestCase
{
{
...
...
app/code/community/EcomDev/PHPUnit/Test/Case/Helper/Guest.php
0 → 100644
View file @
235b96d2
<?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) 2013 EcomDev BV (http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Mike Pretzlaw <pretzlaw@gmail.com>
*/
use
EcomDev_PHPUnit_Helper
as
TestHelper
;
use
EcomDev_PHPUnit_Test_Case_Util
as
TestUtil
;
/**
* Helper for stubbing customer session
*
*
*/
class
EcomDev_PHPUnit_Test_Case_Helper_Guest
extends
EcomDev_PHPUnit_Helper_Abstract
{
/**
* Start session as guest.
*
* @param string|int|null $storeId
*
* @return EcomDev_PHPUnit_Mock_Proxy
*/
public
function
helperGuestSession
(
$storeId
=
null
)
{
$guestSessionMock
=
TestHelper
::
invoke
(
'mockSession'
,
'core/session'
,
array
(
'renewSession'
)
);
/** @var Mage_Core_Model_Session $session */
$session
=
$guestSessionMock
->
getMock
();
$_GET
[
$session
->
getSessionIdQueryParam
()]
=
$session
->
getSessionId
();
// some action need that (loginPost, ...)
if
(
$storeId
===
null
)
{
$storeId
=
TestUtil
::
app
()
->
getAnyStoreView
()
->
getCode
();
}
TestUtil
::
setCurrentStore
(
$storeId
);
return
$guestSessionMock
;
}
}
app/code/community/EcomDev/PHPUnit/etc/config.xml
View file @
235b96d2
...
@@ -99,11 +99,11 @@
...
@@ -99,11 +99,11 @@
<tables>
ecomdev_phpunit/fixture_processor_tables
</tables>
<tables>
ecomdev_phpunit/fixture_processor_tables
</tables>
<vfs>
ecomdev_phpunit/fixture_processor_vfs
</vfs>
<vfs>
ecomdev_phpunit/fixture_processor_vfs
</vfs>
</processors>
</processors>
<attribute>
<attribute>
<!-- Fixture loaders for EAV attributes
<!-- Fixture loaders for EAV attributes
Default can be used but does not support extra attribute table configuration -->
Default can be used but does not support extra attribute table configuration -->
<default>
ecomdev_phpunit/fixture_attribute_default
</default>
<default>
ecomdev_phpunit/fixture_attribute_default
</default>
</attribute>
</attribute>
<eav>
<eav>
<!-- Here goes the list of fixture loaders for EAV entities
<!-- Here goes the list of fixture loaders for EAV entities
If no fixture loader is specified for entity, then default will be used
If no fixture loader is specified for entity, then default will be used
...
@@ -146,6 +146,7 @@
...
@@ -146,6 +146,7 @@
<mock>
EcomDev_PHPUnit_Test_Case_Helper_Mock
</mock>
<mock>
EcomDev_PHPUnit_Test_Case_Helper_Mock
</mock>
<session>
EcomDev_PHPUnit_Test_Case_Helper_Session
</session>
<session>
EcomDev_PHPUnit_Test_Case_Helper_Session
</session>
<customer>
EcomDev_PHPUnit_Test_Case_Helper_Customer
</customer>
<customer>
EcomDev_PHPUnit_Test_Case_Helper_Customer
</customer>
<guest>
EcomDev_PHPUnit_Test_Case_Helper_Guest
</guest>
</helpers>
</helpers>
</suite>
</suite>
</phpunit>
</phpunit>
...
...
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