Skip to content

Commit 592a2b0

Browse files
committed
tests: fix code syntax
1 parent cdad1ae commit 592a2b0

12 files changed

+202
-153
lines changed

phpcs.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0"?>
22
<ruleset name="CakePHP Bootstrap helpers">
3+
<arg name="colors"/>
4+
35
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer" />
46

57
<rule ref="CakePHP" />

tests/TestCase/Utility/StackedStatesTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ public function testPushAndPop()
133133

134134
public function testDefaults()
135135
{
136-
137136
$states = new StackedStates([
138137
't1' => [
139138
'key1' => 2,

tests/TestCase/View/Helper/CardHelperTest.php

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ public function testHeader()
151151
$this->assertHtml([
152152
['div' => [
153153
'class' => 'card-header',
154-
'role' => 'tab',
155-
'id' => 'heading-4',
154+
'role' => 'tab',
155+
'id' => 'heading-4',
156156
]],
157157
['h5' => [
158158
'class' => 'mb-0',
159159
]],
160160
['a' => [
161-
'role' => 'button',
162-
'data-toggle' => 'collapse',
163-
'href' => '#collapse-4',
161+
'role' => 'button',
162+
'data-toggle' => 'collapse',
163+
'href' => '#collapse-4',
164164
'aria-expanded' => 'true',
165165
'aria-controls' => 'collapse-4',
166166
]],
@@ -175,17 +175,17 @@ public function testHeader()
175175
$result = $this->card->header($htmlContent, ['escape' => false]);
176176
$this->assertHtml([
177177
['div' => [
178-
'role' => 'tab',
179-
'id' => 'heading-5',
178+
'role' => 'tab',
179+
'id' => 'heading-5',
180180
'class' => 'card-header',
181181
]],
182182
['h5' => [
183183
'class' => 'mb-0',
184184
]],
185185
['a' => [
186-
'role' => 'button',
187-
'data-toggle' => 'collapse',
188-
'href' => '#collapse-5',
186+
'role' => 'button',
187+
'data-toggle' => 'collapse',
188+
'href' => '#collapse-5',
189189
'aria-expanded' => 'true',
190190
'aria-controls' => 'collapse-5',
191191
]],
@@ -201,17 +201,17 @@ public function testHeader()
201201
$result = $this->card->header($iconContent);
202202
$this->assertHtml([
203203
['div' => [
204-
'role' => 'tab',
205-
'id' => 'heading-6',
204+
'role' => 'tab',
205+
'id' => 'heading-6',
206206
'class' => 'card-header',
207207
]],
208208
['h5' => [
209209
'class' => 'mb-0',
210210
]],
211211
['a' => [
212-
'role' => 'button',
213-
'data-toggle' => 'collapse',
214-
'href' => '#collapse-6',
212+
'role' => 'button',
213+
'data-toggle' => 'collapse',
214+
'href' => '#collapse-6',
215215
'aria-expanded' => 'true',
216216
'aria-controls' => 'collapse-6',
217217
]],
@@ -245,7 +245,6 @@ public function testFooter()
245245

246246
public function testGroup()
247247
{
248-
249248
$cardHeading = 'This is a card heading';
250249
$cardContent = 'A bit of HTML code inside!';
251250

@@ -276,29 +275,29 @@ public function testGroup()
276275
]],
277276
['div' => [
278277
'class' => 'card-header',
279-
'role' => 'tab',
280-
'id' => 'heading-' . $i,
278+
'role' => 'tab',
279+
'id' => 'heading-' . $i,
281280
]],
282281
['h5' => [
283282
'class' => 'mb-0',
284283
]],
285284
['a' => [
286-
'role' => 'button',
287-
'data-toggle' => 'collapse',
288-
'href' => '#collapse-' . $i,
285+
'role' => 'button',
286+
'data-toggle' => 'collapse',
287+
'href' => '#collapse-' . $i,
289288
'aria-expanded' => $i ? 'false' : 'true',
290289
'aria-controls' => 'collapse-' . $i,
291-
'data-parent' => '#cardGroup-1',
290+
'data-parent' => '#cardGroup-1',
292291
]],
293292
$cardHeading,
294293
'/a',
295294
'/h5',
296295
'/div',
297296
['div' => [
298-
'class' => 'collapse' . ($i ? '' : ' in'),
299-
'role' => 'tabpanel',
297+
'class' => 'collapse' . ($i ? '' : ' in'),
298+
'role' => 'tabpanel',
300299
'aria-labelledby' => 'heading-' . $i,
301-
'id' => 'collapse-' . $i,
300+
'id' => 'collapse-' . $i,
302301
]],
303302
['div' => [
304303
'class' => 'card-body',
@@ -334,7 +333,6 @@ public function testGroup()
334333

335334
public function testCardGroupInsideCard()
336335
{
337-
338336
$cardHeading = 'This is a card heading';
339337
$cardContent = 'A bit of HTML code inside!';
340338

@@ -361,8 +359,8 @@ public function testCardGroupInsideCard()
361359
'class' => 'card-body',
362360
]],
363361
['div' => [
364-
'role' => 'tablist',
365-
'id' => 'cardGroup-1',
362+
'role' => 'tablist',
363+
'id' => 'cardGroup-1',
366364
]],
367365
];
368366

@@ -373,29 +371,29 @@ public function testCardGroupInsideCard()
373371
]],
374372
['div' => [
375373
'class' => 'card-header',
376-
'role' => 'tab',
377-
'id' => 'heading-' . $i,
374+
'role' => 'tab',
375+
'id' => 'heading-' . $i,
378376
]],
379377
['h5' => [
380378
'class' => 'mb-0',
381379
]],
382380
['a' => [
383-
'role' => 'button',
384-
'data-toggle' => 'collapse',
385-
'href' => '#collapse-' . $i,
381+
'role' => 'button',
382+
'data-toggle' => 'collapse',
383+
'href' => '#collapse-' . $i,
386384
'aria-expanded' => $i > 1 ? 'false' : 'true',
387385
'aria-controls' => 'collapse-' . $i,
388-
'data-parent' => '#cardGroup-1',
386+
'data-parent' => '#cardGroup-1',
389387
]],
390388
$cardHeading,
391389
'/a',
392390
'/h5',
393391
'/div',
394392
['div' => [
395-
'class' => 'collapse' . ($i > 1 ? '' : ' in'),
396-
'role' => 'tabpanel',
393+
'class' => 'collapse' . ($i > 1 ? '' : ' in'),
394+
'role' => 'tabpanel',
397395
'aria-labelledby' => 'heading-' . $i,
398-
'id' => 'collapse-' . $i,
396+
'id' => 'collapse-' . $i,
399397
]],
400398
['div' => [
401399
'class' => 'card-body',

tests/TestCase/View/Helper/ClassTraitTest.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,11 @@
1212
*/
1313
namespace Bootstrap\Test\TestCase\View\Helper;
1414

15-
use Bootstrap\View\Helper\ClassTrait;
15+
use Bootstrap\TestApp\PublicClassTrait;
1616
use Cake\TestSuite\TestCase;
1717
use Cake\View\View;
1818

19-
class PublicClassTrait
20-
{
21-
use ClassTrait;
22-
23-
public function __construct($view)
24-
{
25-
}
26-
}
27-
28-
class BootstrapTraitTest extends TestCase
19+
class ClassTraitTest extends TestCase
2920
{
3021
/**
3122
* Instance of PublicClassTrait.

tests/TestCase/View/Helper/EasyIconTraitTest.php

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,12 @@
1212
*/
1313
namespace Bootstrap\Test\TestCase\View\Helper;
1414

15-
use Bootstrap\View\Helper\EasyIconTrait;
15+
use Bootstrap\TestApp\PublicEasyIconTrait;
1616
use Bootstrap\View\Helper\FormHelper;
17-
use Bootstrap\View\Helper\HtmlHelper;
1817
use Bootstrap\View\Helper\PaginatorHelper;
1918
use Cake\TestSuite\TestCase;
2019
use Cake\View\View;
2120

22-
class PublicEasyIconTrait
23-
{
24-
use EasyIconTrait;
25-
26-
public function __construct($view)
27-
{
28-
$this->Html = new HtmlHelper($view);
29-
}
30-
31-
public function publicMakeIcon($title, &$converted)
32-
{
33-
return $this->_makeIcon($title, $converted);
34-
}
35-
}
36-
3721
class EasyIconTraitTest extends TestCase
3822
{
3923
/**
@@ -118,7 +102,6 @@ public function testEasyIcon()
118102

119103
public function testHtmlHelperMethods()
120104
{
121-
122105
// BootstrapHtmlHelper
123106
$result = $this->html->link('i:dashboard Dashboard', '/dashboard');
124107
$this->assertHtml([
@@ -134,7 +117,6 @@ public function testHtmlHelperMethods()
134117

135118
public function testPaginatorHelperMethods()
136119
{
137-
138120
// BootstrapPaginatorHelper - TODO
139121
// BootstrapPaginatorHelper::prev($title, array $options = []);
140122
// BootstrapPaginatorHelper::next($title, array $options = []);
@@ -144,22 +126,21 @@ public function testPaginatorHelperMethods()
144126

145127
public function testFormHelperMethod()
146128
{
147-
148129
// BootstrapFormHelper
149130
$result = $this->form->button('i:plus');
150131
$this->assertHtml([
151132
['button' => [
152133
'class' => 'btn btn-primary',
153-
'type' => 'submit',
134+
'type' => 'submit',
154135
]], ['i' => [
155136
'class' => 'fa fa-plus',
156137
'aria-hidden' => 'true',
157138
]], '/i', '/button',
158139
], $result);
159140
$result = $this->form->control('fieldname', [
160141
'prepend' => 'i:home',
161-
'append' => 'i:plus',
162-
'label' => false,
142+
'append' => 'i:plus',
143+
'label' => false,
163144
]);
164145
$this->assertHtml([
165146
['div' => [

0 commit comments

Comments
 (0)