Completed
Pull Request — 2.x (#251)
by
unknown
01:40
created

SwitchLocaleActionTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSwitchLocaleAction() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\TranslationBundle\Tests\Action;
13
14
use PHPUnit\Framework\TestCase;
15
use Sonata\TranslationBundle\Action\SwitchLocaleAction;
16
use Symfony\Component\HttpFoundation\Request;
17
use Symfony\Component\HttpFoundation\Session\Session;
18
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
19
20
/**
21
 * @author Jonathan Vautrin <[email protected]>
22
 */
23
class SwitchLocaleActionTest extends TestCase
24
{
25
    public function testSwitchLocaleAction()
26
    {
27
        $session = new Session(new MockArraySessionStorage());
28
        $session->set('_locale', 'en');
29
        $request = new Request();
30
        $request->setSession($session);
31
        $action = new SwitchLocaleAction();
32
        $action($request, 'fr');
33
        $this->assertSame('fr', $session->get('_locale'));
34
    }
35
}
36