Passed
Push — master ( d2520f...3f8ec2 )
by Michael
02:50
created

TestOfDecoratorTextual::testMonthNamesLong()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 15
nc 1
nop 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 12 and the first side effect is on line 209.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
//
3
4
require_once __DIR__ . '/simple_include.php';
5
require_once __DIR__ . '/calendar_include.php';
6
7
require_once __DIR__ . '/./decorator_test.php';
8
9
/**
10
 * Class TestOfDecoratorTextual.
11
 */
12
class TestOfDecoratorTextual extends TestOfDecorator
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
13
{
14
    /**
15
     * TestOfDecoratorTextual constructor.
16
     */
17
    public function __construct()
18
    {
19
        $this->UnitTestCase('Test of Calendar_Decorator_Textual');
20
    }
21
22
    public function testMonthNamesLong()
23
    {
24
        $Textual    = new Calendar_Decorator_Textual($this->mockcal);
25
        $monthNames = [
26
            1  => 'January',
27
            2  => 'February',
28
            3  => 'March',
29
            4  => 'April',
30
            5  => 'May',
31
            6  => 'June',
32
            7  => 'July',
33
            8  => 'August',
34
            9  => 'September',
35
            10 => 'October',
36
            11 => 'November',
37
            12 => 'December',
38
        ];
39
        $this->assertEqual($monthNames, $Textual->monthNames());
40
    }
41
42
    public function testMonthNamesShort()
43
    {
44
        $Textual    = new Calendar_Decorator_Textual($this->mockcal);
45
        $monthNames = [
46
            1  => 'Jan',
47
            2  => 'Feb',
48
            3  => 'Mar',
49
            4  => 'Apr',
50
            5  => 'May',
51
            6  => 'Jun',
52
            7  => 'Jul',
53
            8  => 'Aug',
54
            9  => 'Sep',
55
            10 => 'Oct',
56
            11 => 'Nov',
57
            12 => 'Dec',
58
        ];
59
        $this->assertEqual($monthNames, $Textual->monthNames('short'));
60
    }
61
62
    public function testMonthNamesTwo()
63
    {
64
        $Textual    = new Calendar_Decorator_Textual($this->mockcal);
65
        $monthNames = [
66
            1  => 'Ja',
67
            2  => 'Fe',
68
            3  => 'Ma',
69
            4  => 'Ap',
70
            5  => 'Ma',
71
            6  => 'Ju',
72
            7  => 'Ju',
73
            8  => 'Au',
74
            9  => 'Se',
75
            10 => 'Oc',
76
            11 => 'No',
77
            12 => 'De',
78
        ];
79
        $this->assertEqual($monthNames, $Textual->monthNames('two'));
80
    }
81
82
    public function testMonthNamesOne()
83
    {
84
        $Textual    = new Calendar_Decorator_Textual($this->mockcal);
85
        $monthNames = [
86
            1  => 'J',
87
            2  => 'F',
88
            3  => 'M',
89
            4  => 'A',
90
            5  => 'M',
91
            6  => 'J',
92
            7  => 'J',
93
            8  => 'A',
94
            9  => 'S',
95
            10 => 'O',
96
            11 => 'N',
97
            12 => 'D',
98
        ];
99
        $this->assertEqual($monthNames, $Textual->monthNames('one'));
100
    }
101
102
    public function testWeekdayNamesLong()
103
    {
104
        $Textual      = new Calendar_Decorator_Textual($this->mockcal);
105
        $weekdayNames = [
106
            0 => 'Sunday',
107
            1 => 'Monday',
108
            2 => 'Tuesday',
109
            3 => 'Wednesday',
110
            4 => 'Thursday',
111
            5 => 'Friday',
112
            6 => 'Saturday',
113
        ];
114
        $this->assertEqual($weekdayNames, $Textual->weekdayNames());
115
    }
116
117
    public function testWeekdayNamesShort()
118
    {
119
        $Textual      = new Calendar_Decorator_Textual($this->mockcal);
120
        $weekdayNames = [
121
            0 => 'Sun',
122
            1 => 'Mon',
123
            2 => 'Tue',
124
            3 => 'Wed',
125
            4 => 'Thu',
126
            5 => 'Fri',
127
            6 => 'Sat',
128
        ];
129
        $this->assertEqual($weekdayNames, $Textual->weekdayNames('short'));
130
    }
131
132
    public function testWeekdayNamesTwo()
133
    {
134
        $Textual      = new Calendar_Decorator_Textual($this->mockcal);
135
        $weekdayNames = [
136
            0 => 'Su',
137
            1 => 'Mo',
138
            2 => 'Tu',
139
            3 => 'We',
140
            4 => 'Th',
141
            5 => 'Fr',
142
            6 => 'Sa',
143
        ];
144
        $this->assertEqual($weekdayNames, $Textual->weekdayNames('two'));
145
    }
146
147
    public function testWeekdayNamesOne()
148
    {
149
        $Textual      = new Calendar_Decorator_Textual($this->mockcal);
150
        $weekdayNames = [
151
            0 => 'S',
152
            1 => 'M',
153
            2 => 'T',
154
            3 => 'W',
155
            4 => 'T',
156
            5 => 'F',
157
            6 => 'S',
158
        ];
159
        $this->assertEqual($weekdayNames, $Textual->weekdayNames('one'));
160
    }
161
162
    public function testPrevMonthNameShort()
163
    {
164
        $Textual = new Calendar_Decorator_Textual($this->mockcal);
165
        $this->assertEqual('Sep', $Textual->prevMonthName('short'));
166
    }
167
168
    public function testThisMonthNameShort()
169
    {
170
        $Textual = new Calendar_Decorator_Textual($this->mockcal);
171
        $this->assertEqual('Oct', $Textual->thisMonthName('short'));
172
    }
173
174
    public function testNextMonthNameShort()
175
    {
176
        $Textual = new Calendar_Decorator_Textual($this->mockcal);
177
        $this->assertEqual('Nov', $Textual->nextMonthName('short'));
178
    }
179
180
    public function testThisDayNameShort()
181
    {
182
        $Textual = new Calendar_Decorator_Textual($this->mockcal);
183
        $this->assertEqual('Wed', $Textual->thisDayName('short'));
184
    }
185
186
    public function testOrderedWeekdaysShort()
187
    {
188
        $weekdayNames = [
189
            0 => 'Sun',
190
            1 => 'Mon',
191
            2 => 'Tue',
192
            3 => 'Wed',
193
            4 => 'Thu',
194
            5 => 'Fri',
195
            6 => 'Sat',
196
        ];
197
        $nShifts      = CALENDAR_FIRST_DAY_OF_WEEK;
198
        while ($nShifts-- > 0) {
199
            $day = array_shift($weekdayNames);
200
            array_push($weekdayNames, $day);
201
        }
202
        $Textual = new Calendar_Decorator_Textual($this->mockcal);
203
        $this->assertEqual($weekdayNames, $Textual->orderedWeekdays('short'));
204
    }
205
}
206
207
if (!defined('TEST_RUNNING')) {
208
    define('TEST_RUNNING', true);
209
    $test = new TestOfDecoratorTextual();
210
    $test->run(new HtmlReporter());
0 ignored issues
show
Bug introduced by
The type HtmlReporter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
211
}
212