Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added info how to disable the mock session #8387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions components/http_foundation/session_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,44 @@ separate PHP processes, simply change the storage engine to
use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage;

$session = new Session(new MockFileSessionStorage());

Disabling the Mock Session
--------------------------

When using the HttpFoundation component in a Symfony application, you can
disable the mock session and use the normal PHP session defined in ``php.ini``
commenting or removing these lines from the testing configuration:

.. configuration-block::

.. code-block:: yaml

# app/config/config_test.yml
framework:
session:
storage_id: session.storage.mock_file

.. code-block:: xml

<!-- app/config/config_test.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<framework:config>
<framework:session storage-id="session.storage.mock_file" />
</framework:config>
</container>

.. code-block:: php

// app/config/config_test.php
$container->loadFromExtension('framework', array(
'session' => array(
'storage_id' => 'session.storage.mock_file',
),
));