LinkAttributesExtensionSpec   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 14
lcom 0
cbo 1
dl 0
loc 77
rs 10
c 0
b 0
f 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 6 1
A it_should_be_a_twig_extension() 0 4 1
A it_should_have_a_name() 0 4 1
A it_should_have_the_csrf_attribute_function() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_delete_method_with_default_confirmation_message() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_delete_method_with_a_specified_confirmation_message() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_delete_method_with_no_confirmation_attribute() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_post_method() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_post_method_with_a_specified_confirmation_message() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_put_method() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_put_method_with_a_specified_confirmation_message() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_patch_method() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_patch_method_with_a_specified_confirmation_message() 0 4 1
A its_getLinkAttributes_should_return_html_attributes_for_specified_method_even_if_it_is_fancy() 0 4 1
1
<?php
2
3
namespace spec\Knp\RadBundle\Twig;
4
5
use PhpSpec\ObjectBehavior;
6
7
class LinkAttributesExtensionSpec extends ObjectBehavior
8
{
9
    /**
10
     * @param Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface $csrfProvider
11
     */
12
    function let($csrfProvider)
13
    {
14
        $csrfProvider->generateCsrfToken('link')->willReturn('some token');
15
16
        $this->beConstructedWith($csrfProvider);
17
    }
18
19
    function it_should_be_a_twig_extension()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::it_should_be_a_twig_extension" is not in camel caps format
Loading history...
20
    {
21
        $this->shouldHaveType('Twig_Extension');
22
    }
23
24
    function it_should_have_a_name()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::it_should_have_a_name" is not in camel caps format
Loading history...
25
    {
26
        $this->getName()->shouldReturn('link_attributes');
27
    }
28
29
    function it_should_have_the_csrf_attribute_function()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::it_should_have_the_csrf_attribute_function" is not in camel caps format
Loading history...
30
    {
31
        $this->getFunctions()->shouldHaveCount(2);
32
    }
33
34
    function its_getLinkAttributes_should_return_html_attributes_for_delete_method_with_default_confirmation_message()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_delete_method_with_default_confirmation_message" is not in camel caps format
Loading history...
35
    {
36
        $this->getLinkAttributes('delete')->shouldReturn('data-method="delete" data-confirm="Are you sure?" data-csrf-token="some token"');
37
    }
38
39
    function its_getLinkAttributes_should_return_html_attributes_for_delete_method_with_a_specified_confirmation_message()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_delete_method_with_a_specified_confirmation_message" is not in camel caps format
Loading history...
40
    {
41
        $this->getLinkAttributes('delete', 'a confirmation message')->shouldReturn('data-method="delete" data-confirm="a confirmation message" data-csrf-token="some token"');
42
    }
43
44
    function its_getLinkAttributes_should_return_html_attributes_for_delete_method_with_no_confirmation_attribute()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_delete_method_with_no_confirmation_attribute" is not in camel caps format
Loading history...
45
    {
46
        $this->getLinkAttributes('delete', false)->shouldReturn('data-method="delete" data-no-confirm data-csrf-token="some token"');
47
    }
48
49
    function its_getLinkAttributes_should_return_html_attributes_for_post_method()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_post_method" is not in camel caps format
Loading history...
50
    {
51
        $this->getLinkAttributes('post')->shouldReturn('data-method="post" data-confirm="Are you sure?" data-csrf-token="some token"');
52
    }
53
54
    function its_getLinkAttributes_should_return_html_attributes_for_post_method_with_a_specified_confirmation_message()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_post_method_with_a_specified_confirmation_message" is not in camel caps format
Loading history...
55
    {
56
        $this->getLinkAttributes('post', 'Please confirm')->shouldReturn('data-method="post" data-confirm="Please confirm" data-csrf-token="some token"');
57
    }
58
59
    function its_getLinkAttributes_should_return_html_attributes_for_put_method()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_put_method" is not in camel caps format
Loading history...
60
    {
61
        $this->getLinkAttributes('put')->shouldReturn('data-method="put" data-confirm="Are you sure?" data-csrf-token="some token"');
62
    }
63
64
    function its_getLinkAttributes_should_return_html_attributes_for_put_method_with_a_specified_confirmation_message()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_put_method_with_a_specified_confirmation_message" is not in camel caps format
Loading history...
65
    {
66
        $this->getLinkAttributes('put', 'Please confirm')->shouldReturn('data-method="put" data-confirm="Please confirm" data-csrf-token="some token"');
67
    }
68
69
    function its_getLinkAttributes_should_return_html_attributes_for_patch_method()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_patch_method" is not in camel caps format
Loading history...
70
    {
71
        $this->getLinkAttributes('patch')->shouldReturn('data-method="patch" data-confirm="Are you sure?" data-csrf-token="some token"');
72
    }
73
74
    function its_getLinkAttributes_should_return_html_attributes_for_patch_method_with_a_specified_confirmation_message()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_patch_method_with_a_specified_confirmation_message" is not in camel caps format
Loading history...
75
    {
76
        $this->getLinkAttributes('patch', 'Please confirm')->shouldReturn('data-method="patch" data-confirm="Please confirm" data-csrf-token="some token"');
77
    }
78
79
    function its_getLinkAttributes_should_return_html_attributes_for_specified_method_even_if_it_is_fancy()
0 ignored issues
show
Coding Style introduced by
Method name "LinkAttributesExtensionSpec::its_getLinkAttributes_should_return_html_attributes_for_specified_method_even_if_it_is_fancy" is not in camel caps format
Loading history...
80
    {
81
        $this->getLinkAttributes('fancy', 'Please confirm')->shouldReturn('data-method="fancy" data-confirm="Please confirm" data-csrf-token="some token"');
82
    }
83
}
84