Code Duplication    Length = 11-16 lines in 5 locations

src/SumoCoders/FrameworkCoreBundle/Tests/Controller/DatePickerControllerTest.php 5 locations

@@ 48-58 (lines=11) @@
45
        $this->assertEquals(1, $crawler->filter('input#form_date_example3')->count());
46
    }
47
48
    public function testIfSingleTextWithDatePickerAndDefaultDateRenderedCorrectly()
49
    {
50
        $crawler = $this->getCrawlerForRequest('GET', '/_tests/datepicker');
51
52
        $element = $crawler->filter('input#form_date_example4');
53
        $wrapper = $element->parents()->filter('.date-widget')->first();
54
55
        $this->assertEquals(1, $element->count());
56
        $this->assertEquals(1, $wrapper->count());
57
        $this->assertEquals('20/06/1985', $element->attr('value'));
58
    }
59
60
    public function testIfSingleTextWithDatePickerRenderedCorrectly()
61
    {
@@ 60-72 (lines=13) @@
57
        $this->assertEquals('20/06/1985', $element->attr('value'));
58
    }
59
60
    public function testIfSingleTextWithDatePickerRenderedCorrectly()
61
    {
62
        $crawler = $this->getCrawlerForRequest('GET', '/_tests/datepicker');
63
        $date = new \DateTime();
64
65
        $element = $crawler->filter('input#form_date_example5');
66
        $wrapper = $element->parents()->filter('.date-widget')->first();
67
68
        $this->assertEquals(1, $element->count());
69
        $this->assertEquals(1, $wrapper->count());
70
71
        $this->assertEquals($date->format('d/m/Y'), $element->attr('value'));
72
    }
73
74
    public function testIfSingleTextWithDatePickerAndOnlyDatesInTheFutureRenderedCorrectly()
75
    {
@@ 128-140 (lines=13) @@
125
        $this->assertEquals($date->format('d/m/Y'), $element->attr('value'));
126
    }
127
128
    public function testIfSingleTextWithoutDefaultDateRenderedCorrectly()
129
    {
130
        $crawler = $this->getCrawlerForRequest('GET', '/_tests/datepicker');
131
132
        $element = $crawler->filter('input#form_date_example9');
133
        $wrapper = $element->parents()->filter('.date-widget')->first();
134
135
        $this->assertEquals(1, $element->count());
136
        $this->assertEquals(1, $wrapper->count());
137
138
        // check if the actual element is hidden
139
        $this->assertEquals('', $element->attr('value'));
140
    }
141
}
142
@@ 74-89 (lines=16) @@
71
        $this->assertEquals($date->format('d/m/Y'), $element->attr('value'));
72
    }
73
74
    public function testIfSingleTextWithDatePickerAndOnlyDatesInTheFutureRenderedCorrectly()
75
    {
76
        $crawler = $this->getCrawlerForRequest('GET', '/_tests/datepicker');
77
        $date = new \DateTime();
78
        $startDate = new \DateTime('last monday');
79
80
        $element = $crawler->filter('input#form_date_example6');
81
82
        $this->assertEquals(1, $element->count());
83
84
        // check if it has all the required data-attributes
85
        $this->assertEquals($startDate->format('d/m/Y'), $element->attr('data-date-start-date'));
86
87
        // check if the actual element is hidden
88
        $this->assertEquals($date->format('d/m/Y'), $element->attr('value'));
89
    }
90
91
    public function testIfSingleTextWithDatePickerAndOnlyDatesInThePastRenderedCorrectly()
92
    {
@@ 91-106 (lines=16) @@
88
        $this->assertEquals($date->format('d/m/Y'), $element->attr('value'));
89
    }
90
91
    public function testIfSingleTextWithDatePickerAndOnlyDatesInThePastRenderedCorrectly()
92
    {
93
        $crawler = $this->getCrawlerForRequest('GET', '/_tests/datepicker');
94
        $date = new \DateTime();
95
        $endDate = new \DateTime('next friday');
96
97
        $element = $crawler->filter('input#form_date_example7');
98
99
        $this->assertEquals(1, $element->count());
100
101
        // check if it has all the required data-attributes
102
        $this->assertEquals($endDate->format('d/m/Y'), $element->attr('data-date-end-date'));
103
104
        // check if the actual element is hidden
105
        $this->assertEquals($date->format('d/m/Y'), $element->attr('value'));
106
    }
107
108
    public function testIfSingleTextWithDatePickerAndOnlyDatesBetweenCorrectly()
109
    {