Completed
Push — master ( 4c7b9c...e919dc )
by Kamil
21:11
created

AuthenticationSuccessHandlerSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 31
rs 10
c 1
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_extends_default_authentication_success_handler() 0 4 1
A it_is_a_authentication_success_handler() 0 4 1
A it_returns_json_response_if_it_was_ajax_call() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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 spec\Sylius\Bundle\UserBundle\Authentication;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Bundle\UserBundle\Authentication\AuthenticationSuccessHandler;
16
use Symfony\Component\HttpFoundation\Request;
17
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
18
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
19
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;
20
use Symfony\Component\Security\Http\HttpUtils;
21
22
/**
23
 * @mixin AuthenticationSuccessHandler
24
 *
25
 * @author Arkadiusz Krakowiak <[email protected]>
26
 */
27
class AuthenticationSuccessHandlerSpec extends ObjectBehavior
28
{
29
    function let(HttpUtils $httpUtils)
30
    {
31
        $this->beConstructedWith($httpUtils);
32
    }
33
34
    function it_is_initializable()
35
    {
36
        $this->shouldHaveType('Sylius\Bundle\UserBundle\Authentication\AuthenticationSuccessHandler');
37
    }
38
39
    function it_extends_default_authentication_success_handler()
40
    {
41
        $this->shouldHaveType(DefaultAuthenticationSuccessHandler::class);
42
    }
43
44
    function it_is_a_authentication_success_handler()
45
    {
46
        $this->shouldImplement(AuthenticationSuccessHandlerInterface::class);
47
    }
48
49
    function it_returns_json_response_if_it_was_ajax_call(
50
        Request $request,
51
        TokenInterface $token
52
    ) {
53
        $request->isXmlHttpRequest()->willReturn(true);
54
55
        $this->onAuthenticationSuccess($request, $token);
56
    }
57
}
58