ArgumentResolverSpec   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 38
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_should_resolve_scalar_arguments() 0 4 1
A it_should_resolve_path_arguments() 0 6 1
A it_should_throw_exception_when_an_argument_has_both_value_and_name() 0 4 1
A it_should_throw_exception_when_an_argument_has_no_value_nor_name() 0 4 1
A it_should_throw_exception_when_an_argument_has_extra_keys() 0 4 1
1
<?php
2
3
namespace spec\Knp\RadBundle\Resource\Resolver\OptionsBased;
4
5
use PhpSpec\ObjectBehavior;
6
7
class ArgumentResolverSpec extends ObjectBehavior
8
{
9
    /**
10
     * @param Knp\RadBundle\HttpFoundation\RequestManipulator $requestManipulator
11
     * @param Symfony\Component\HttpFoundation\Request $request
12
     */
13
    function let($requestManipulator, $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
    {
15
        $this->beConstructedWith($requestManipulator);
16
    }
17
18
    function it_should_resolve_scalar_arguments($request)
0 ignored issues
show
Coding Style introduced by
Method name "ArgumentResolverSpec::it_should_resolve_scalar_arguments" is not in camel caps format
Loading history...
19
    {
20
        $this->resolveArgument($request, array('value' => 'the value'))->shouldReturn('the value');
21
    }
22
23
    function it_should_resolve_path_arguments($requestManipulator, $request)
0 ignored issues
show
Coding Style introduced by
Method name "ArgumentResolverSpec::it_should_resolve_path_arguments" is not in camel caps format
Loading history...
24
    {
25
        $requestManipulator->getAttribute($request, 'slug')->shouldBeCalled()->willReturn('mimolette');
26
27
        $this->resolveArgument($request, array('name' => 'slug'))->shouldReturn('mimolette');
28
    }
29
30
    function it_should_throw_exception_when_an_argument_has_both_value_and_name($request)
0 ignored issues
show
Coding Style introduced by
Method name "ArgumentResolverSpec::it_should_throw_exception_when_an_argument_has_both_value_and_name" is not in camel caps format
Loading history...
31
    {
32
        $this->shouldThrow()->duringResolveArgument($request, array('name' => 'slug', 'value' => 'camember'));
33
    }
34
35
    function it_should_throw_exception_when_an_argument_has_no_value_nor_name($request)
0 ignored issues
show
Coding Style introduced by
Method name "ArgumentResolverSpec::it_should_throw_exception_when_an_argument_has_no_value_nor_name" is not in camel caps format
Loading history...
36
    {
37
        $this->shouldThrow()->duringResolveArgument($request, array());
38
    }
39
40
    function it_should_throw_exception_when_an_argument_has_extra_keys($request)
0 ignored issues
show
Coding Style introduced by
Method name "ArgumentResolverSpec::it_should_throw_exception_when_an_argument_has_extra_keys" is not in camel caps format
Loading history...
41
    {
42
        $this->shouldThrow()->duringResolveArgument($request, array('name' => 'slug', 'foo' => 'bar'));
43
    }
44
}
45