15 import(
'lib.pkp.tests.PKPTestCase');
20 protected function setUp() : void {
27 unset($this->publication);
36 $expected = array(array(
'i',
'ix'), array(
'6',
'11'), array(
'19'), array(
'21'));
38 $this->publication->setData(
'pages',
'pg. i-ix, 6-11, 19, 21');
39 $pageArray = $this->publication->getPageArray();
40 $this->assertSame($expected,$pageArray);
42 $this->publication->setData(
'pages',
'i-ix,6-11,19,21');
43 $pageArray = $this->publication->getPageArray();
44 $this->assertSame($expected,$pageArray);
46 $this->publication->setData(
'pages',
'i--ix,6--11,19,21');
47 $pageArray = $this->publication->getPageArray();
48 $this->assertSame($expected,$pageArray);
50 $expected = array(array(
'16'));
51 $this->publication->setData(
'pages',
'16');
52 $pageArray = $this->publication->getPageArray();
53 $this->assertSame($expected,$pageArray);
55 $expected = array(array(
'16',
'20'));
56 $this->publication->setData(
'pages',
'16 - 20');
57 $pageArray = $this->publication->getPageArray();
58 $this->assertSame($expected,$pageArray);
60 $expected = array(array(
'a6',
'a12'), array(
'b43'));
61 $this->publication->setData(
'pages',
'a6-a12,b43');
62 $pageArray = $this->publication->getPageArray();
63 $this->assertSame($expected,$pageArray);
65 $this->publication->setData(
'pages',
'pp: a6 -a12, b43');
66 $pageArray = $this->publication->getPageArray();
67 $this->assertSame($expected,$pageArray);
68 $this->publication->setData(
'pages',
' a6 -a12, b43 ');
69 $pageArray = $this->publication->getPageArray();
70 $this->assertSame($expected,$pageArray);
73 $this->publication->setData(
'pages',
'');
74 $pageArray = $this->publication->getPageArray();
75 $this->assertSame($expected,$pageArray);
76 $this->publication->setData(
'pages',
' ');
77 $pageArray = $this->publication->getPageArray();
78 $this->assertSame($expected,$pageArray);
79 $expected = array(array(
'0'));
80 $this->publication->setData(
'pages',
'0');
81 $pageArray = $this->publication->getPageArray();
82 $this->assertSame($expected,$pageArray);
91 $this->publication->setData(
'pages',
'pg. i-ix, 6-11, 19, 21');
92 $startingPage = $this->publication->getStartingPage();
93 $this->assertSame($expected,$startingPage);
95 $this->publication->setData(
'pages',
'i-ix,6-11,19,21');
96 $startingPage = $this->publication->getStartingPage();
97 $this->assertSame($expected,$startingPage);
99 $this->publication->setData(
'pages',
'i--ix,6--11,19,21');
100 $startingPage = $this->publication->getStartingPage();
101 $this->assertSame($expected,$startingPage);
104 $this->publication->setData(
'pages',
'16');
105 $startingPage = $this->publication->getStartingPage();
106 $this->assertSame($expected,$startingPage);
108 $this->publication->setData(
'pages',
'16 - 20');
109 $startingPage = $this->publication->getStartingPage();
110 $this->assertSame($expected,$startingPage);
113 $this->publication->setData(
'pages',
'a6-a12,b43');
114 $startingPage = $this->publication->getStartingPage();
115 $this->assertSame($expected,$startingPage);
117 $this->publication->setData(
'pages',
'pp: a6 -a12, b43');
118 $startingPage = $this->publication->getStartingPage();
119 $this->assertSame($expected,$startingPage);
120 $this->publication->setData(
'pages',
' a6 -a12, b43 ');
121 $startingPage = $this->publication->getStartingPage();
122 $this->assertSame($expected,$startingPage);
125 $this->publication->setData(
'pages',
'');
126 $startingPage = $this->publication->getStartingPage();
127 $this->assertSame($expected,$startingPage);
128 $this->publication->setData(
'pages',
' ');
129 $startingPage = $this->publication->getStartingPage();
130 $this->assertSame($expected,$startingPage);
132 $this->publication->setData(
'pages',
'0');
133 $startingPage = $this->publication->getStartingPage();
134 $this->assertSame($expected,$startingPage);
143 $this->publication->setData(
'pages',
'pg. i-ix, 6-11, 19, 21');
144 $endingPage = $this->publication->getEndingPage();
145 $this->assertSame($expected,$endingPage);
147 $this->publication->setData(
'pages',
'i-ix,6-11,19,21');
148 $endingPage = $this->publication->getEndingPage();
149 $this->assertSame($expected,$endingPage);
151 $this->publication->setData(
'pages',
'i--ix,6--11,19,21');
152 $endingPage = $this->publication->getEndingPage();
153 $this->assertSame($expected,$endingPage);
156 $this->publication->setData(
'pages',
'16');
157 $endingPage = $this->publication->getEndingPage();
158 $this->assertSame($expected,$endingPage);
161 $this->publication->setData(
'pages',
'16 - 20');
162 $endingPage = $this->publication->getEndingPage();
163 $this->assertSame($expected,$endingPage);
166 $this->publication->setData(
'pages',
'a6-a12,b43');
167 $endingPage = $this->publication->getEndingPage();
168 $this->assertSame($expected,$endingPage);
170 $this->publication->setData(
'pages',
'pp: a6 -a12, b43');
171 $endingPage = $this->publication->getEndingPage();
172 $this->assertSame($expected,$endingPage);
173 $this->publication->setData(
'pages',
' a6 -a12, b43 ');
174 $endingPage = $this->publication->getEndingPage();
175 $this->assertSame($expected,$endingPage);
178 $this->publication->setData(
'pages',
'');
179 $endingPage = $this->publication->getEndingPage();
180 $this->assertSame($expected,$endingPage);
181 $this->publication->setData(
'pages',
' ');
182 $endingPage = $this->publication->getEndingPage();
183 $this->assertSame($expected,$endingPage);
185 $this->publication->setData(
'pages',
'0');
186 $endingPage = $this->publication->getEndingPage();
187 $this->assertSame($expected,$endingPage);