Skip to content

Commit 625e1db

Browse files
authored
Merge pull request #595 from formers/laravel-8
2 parents 2fcc1f6 + 5dda9f8 commit 625e1db

24 files changed

+724
-73
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Development
22
.idea
3+
.phpunit.result.cache
34

45
# Dependencies
56
composer.lock

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: php
22

33
php:
4-
- 7.1
54
- 7.2
65
- 7.3
6+
- 7.4
77
- nightly
88

99
# This triggers builds to run on the new TravisCI infrastructure.

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.4.0",
19+
"php": ">=7.2.0",
2020
"anahkiasen/html-object": "~1.4",
21-
"illuminate/config": "~5.0|^6.0|^7.0",
22-
"illuminate/container": "~5.0|^6.0|^7.0",
23-
"illuminate/http": "~5.0|^6.0|^7.0",
24-
"illuminate/routing": "~5.0|^6.0|^7.0",
25-
"illuminate/session": "~5.0|^6.0|^7.0",
26-
"illuminate/translation": "~5.0|^6.0|^7.0",
27-
"illuminate/support": "~5.0|^6.0|^7.0"
21+
"illuminate/config": "~5.0|^6.0|^7.0|^8.0",
22+
"illuminate/container": "~5.0|^6.0|^7.0|^8.0",
23+
"illuminate/http": "~5.0|^6.0|^7.0|^8.0",
24+
"illuminate/routing": "~5.0|^6.0|^7.0|^8.0",
25+
"illuminate/session": "~5.0|^6.0|^7.0|^8.0",
26+
"illuminate/translation": "~5.0|^6.0|^7.0|^8.0",
27+
"illuminate/support": "~5.0|^6.0|^7.0|^8.0"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "~4",
31-
"mockery/mockery": "~0.9.1",
32-
"illuminate/database": "~5.0|^6.0|^7.0"
30+
"phpunit/phpunit": "^8.5",
31+
"mockery/mockery": "^1.3",
32+
"illuminate/database": "~5.0|^6.0|^7.0|^8.0"
3333
},
3434
"autoload": {
3535
"psr-4": {

phpunit.xml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
syntaxCheck="false">
12-
13-
<testsuites>
14-
<testsuite name="Former Test Suite">
15-
<directory>tests</directory>
16-
</testsuite>
17-
</testsuites>
18-
</phpunit>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false">
11+
<testsuites>
12+
<testsuite name="Former Test Suite">
13+
<directory>tests</directory>
14+
</testsuite>
15+
</testsuites>
16+
</phpunit>

tests/Fields/CheckboxTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ public function testCanPushCheckboxesWithoutLabels()
583583
$html = $this->former->label('<b>Views per Page</b>')->render();
584584
$html .= $this->former->checkbox('per_page')->class('input')->render();
585585

586-
$this->assertInternalType('string', $html);
586+
$this->assertIsString($html);
587587
}
588588

589589
public function testDisabled()
@@ -606,6 +606,8 @@ public function testToStringMagicMethodShouldOnlyReturnString()
606606
$this->former->group();
607607
$output = $this->former->checkbox('foo')->text('bar').'';
608608
$this->former->closeGroup();
609+
610+
$this->assertIsString($output);
609611
}
610612

611613
public function testCanBeManualyDefinied()

tests/Fields/ChoiceCheckboxTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,5 +431,7 @@ public function testToStringMagicMethodShouldOnlyReturnString()
431431
$this->former->group();
432432
$output = $this->choiceCheckbox()->choices(array('foo')).'';
433433
$this->former->closeGroup();
434+
435+
$this->assertIsString($output);
434436
}
435437
}

tests/Fields/ChoiceRadioTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,5 +431,7 @@ public function testToStringMagicMethodShouldOnlyReturnString()
431431
$this->former->group();
432432
$output = $this->choiceRadio()->choices(array('foo')).'';
433433
$this->former->closeGroup();
434+
435+
$this->assertIsString($output);
434436
}
435437
}

tests/Fields/ChoiceSelectTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public function testCanRenderSelectsDynamically()
333333
$html[] = $this->former->choice('frmVehicleMake')->label('Make')->choices($this->choices)->wrapAndRender();
334334

335335
$results = implode(' ', $html);
336-
$this->assertContains('control-group', $results);
336+
$this->assertStringContainsString('control-group', $results);
337337
}
338338

339339
public function testCanPopulateMultipleSelects()
@@ -410,8 +410,8 @@ public function testCanCreateRangeSelects()
410410
$select = $this->former->choice('foo')->range(1, 10);
411411

412412
$this->assertEquals(range(1, 10), array_keys($select->getChoices()));
413-
$this->assertContains('<option value="1">1</option>', $select->render());
414-
$this->assertContains('<option value="10">10</option>', $select->render());
413+
$this->assertStringContainsString('<option value="1">1</option>', $select->render());
414+
$this->assertStringContainsString('<option value="10">10</option>', $select->render());
415415
}
416416

417417
public function testCanCreateSelectGroups()
@@ -528,6 +528,6 @@ public function testSelectCanPickRightOptionWithOptgroups()
528528
$select = $this->former->choice('category_id')->choices($items)->value(1);
529529
$matcher = '<optgroup label="foo"><option value="1" selected="selected">foo</option></optgroup><optgroup label="bar"><option value="3">bar</option><option value="4">baz</option></optgroup>';
530530

531-
$this->assertContains($matcher, $select->render());
531+
$this->assertStringContainsString($matcher, $select->render());
532532
}
533533
}

tests/Fields/HiddenTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ public function testCanPopulateHiddenFields()
3131
public function testEncodedValue()
3232
{
3333
$input = $this->former->hidden('foo')->value('<a>bar</a>')->__toString();
34-
$this->assertContains('value="&lt;a&gt;bar&lt;/a&gt;"', $input);
34+
$this->assertStringContainsString('value="&lt;a&gt;bar&lt;/a&gt;"', $input);
3535
}
3636
}

tests/Fields/InputTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public function testCanCreateNumberRange()
309309
{
310310
$range = $this->former->number('foo')->range(1, 5)->__toString();
311311

312-
$this->assertContains('min="1" max="5"', $range);
312+
$this->assertStringContainsString('min="1" max="5"', $range);
313313
}
314314

315315
public function testLabelCastsToString()

tests/Fields/RadioTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public function testInlineRadiosAreRendered()
313313

314314
$radio = $this->former->radio('foo', 'bar')->__toString();
315315

316-
$this->assertInternalType('string', $radio);
316+
$this->assertIsString($radio);
317317
}
318318

319319
public function testDisabled()
@@ -336,6 +336,8 @@ public function testToStringMagicMethodShouldOnlyReturnString()
336336
$this->former->group();
337337
$output = $this->former->radio('foo')->text('bar').'';
338338
$this->former->closeGroup();
339+
340+
$this->assertIsString($output);
339341
}
340342

341343
public function testCanBeManualyDefinied()

tests/Fields/SelectTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public function testCanRenderSelectsDynamically()
333333
$html[] = $this->former->select('frmVehicleMake')->label('Make')->options($this->options)->wrapAndRender();
334334

335335
$results = implode(' ', $html);
336-
$this->assertContains('control-group', $results);
336+
$this->assertStringContainsString('control-group', $results);
337337
}
338338

339339
public function testCanPopulateMultipleSelects()
@@ -410,8 +410,8 @@ public function testCanCreateRangeSelects()
410410
$select = $this->former->select('foo')->range(1, 10);
411411

412412
$this->assertEquals(range(1, 10), array_keys($select->getOptions()));
413-
$this->assertContains('<option value="1">1</option>', $select->render());
414-
$this->assertContains('<option value="10">10</option>', $select->render());
413+
$this->assertStringContainsString('<option value="1">1</option>', $select->render());
414+
$this->assertStringContainsString('<option value="10">10</option>', $select->render());
415415
}
416416

417417
public function testCanCreateSelectGroups()
@@ -481,8 +481,8 @@ public function testOptionsSelectActsTheSameAsSelect()
481481

482482
$matcher = '<option value="0" selected="selected">foo</option><option value="1">bar</option>';
483483

484-
$this->assertContains($matcher, $select2);
485-
$this->assertContains($matcher, $select);
484+
$this->assertStringContainsString($matcher, $select2);
485+
$this->assertStringContainsString($matcher, $select);
486486
}
487487

488488
public function testCanRepopulateFromPostArrayNotation()
@@ -540,6 +540,6 @@ public function testSelectCanPickRightOptionWithOptgroups()
540540
$select = $this->former->select('category_id')->options($items, 1);
541541
$matcher = '<optgroup label="foo"><option value="1" selected="selected">foo</option></optgroup><optgroup label="bar"><option value="3">bar</option><option value="4">baz</option></optgroup>';
542542

543-
$this->assertContains($matcher, $select->render());
543+
$this->assertStringContainsString($matcher, $select->render());
544544
}
545545
}

tests/Framework/NudeFrameworkTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class NudeFrameworkTest extends FormerTests
77
{
88

9-
public function setUp()
9+
public function setUp(): void
1010
{
1111
parent::setUp();
1212

tests/Framework/TwitterBootstrap3Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class TwitterBootstrap3Test extends FormerTests
77
{
88

9-
public function setUp()
9+
public function setUp(): void
1010
{
1111
parent::setUp();
1212

@@ -206,6 +206,6 @@ public function testButtonsAreWrappedInSpecialClass()
206206
$button = $this->former->text('foo')->append($this->former->button('Search'))->wrapAndRender();
207207
$matcher = '<span class="input-group-btn"><button class="btn" type="button">Search</button></span>';
208208

209-
$this->assertContains($matcher, $button);
209+
$this->assertStringContainsString($matcher, $button);
210210
}
211211
}

tests/Framework/TwitterBootstrap4Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class TwitterBootstrap4Test extends FormerTests
77
{
88

9-
public function setUp()
9+
public function setUp(): void
1010
{
1111
parent::setUp();
1212

@@ -207,6 +207,6 @@ public function testButtonsAreWrappedInSpecialClass()
207207
$button = $this->former->text('foo')->append($this->former->button('Search'))->wrapAndRender();
208208
$matcher = '<span class="input-group-btn"><button class="btn" type="button">Search</button></span>';
209209

210-
$this->assertContains($matcher, $button);
210+
$this->assertStringContainsString($matcher, $button);
211211
}
212212
}

tests/Framework/TwitterBootstrapTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class TwitterBootstrapTest extends FormerTests
88
{
99

10-
public function setUp()
10+
public function setUp(): void
1111
{
1212
parent::setUp();
1313

tests/Framework/ZurbFramework4Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class ZurbFramework4Test extends FormerTests
77
{
88

9-
public function setUp()
9+
public function setUp(): void
1010
{
1111
parent::setUp();
1212

@@ -63,7 +63,7 @@ public function testCanAppendHelpTexts()
6363

6464
public function testCantUseBootstrapReservedMethods()
6565
{
66-
$this->setExpectedException('BadMethodCallException');
66+
$this->expectException('BadMethodCallException');
6767

6868
$this->former->text('foo')->blockHelp('bar')->__toString();
6969
}

tests/Framework/ZurbFramework5Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class ZurbFramework5Test extends FormerTests
77
{
88

9-
public function setUp()
9+
public function setUp(): void
1010
{
1111
parent::setUp();
1212

@@ -63,7 +63,7 @@ public function testCanAppendHelpTexts()
6363

6464
public function testCantUseBootstrapReservedMethods()
6565
{
66-
$this->setExpectedException('BadMethodCallException');
66+
$this->expectException('BadMethodCallException');
6767

6868
$this->former->text('foo')->blockHelp('bar')->__toString();
6969
}

tests/Framework/ZurbFrameworkTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class ZurbFrameworkTest extends FormerTests
77
{
88

9-
public function setUp()
9+
public function setUp(): void
1010
{
1111
parent::setUp();
1212

@@ -62,7 +62,7 @@ public function testCanAppendHelpTexts()
6262

6363
public function testCantUseBootstrapReservedMethods()
6464
{
65-
$this->setExpectedException('BadMethodCallException');
65+
$this->expectException('BadMethodCallException');
6666

6767
$this->former->text('foo')->blockHelp('bar')->__toString();
6868
}

tests/GroupTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,14 @@ public function testFieldsInCustomGroupsAreRawByDefault()
348348
$this->former->group('foobar');
349349
$test = $this->former->text('foobar')->__toString();
350350

351-
$this->assertNotContains('control-group', $test);
351+
$this->assertStringNotContainsString('control-group', $test);
352352
}
353353

354354
public function testCanSetAttributesOnGroup()
355355
{
356356
$text = $this->former->text('foobar')->onGroupAddClass('foobar')->__toString();
357357

358-
$this->assertContains('control-group foobar', $text);
358+
$this->assertStringContainsString('control-group foobar', $text);
359359
}
360360

361361
public function testCloseUnopenedGroup()

tests/LiveValidationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ public function testNoMaxFileOnSecondFile()
616616
$matcher2 = $this->matchField([], 'file', 'bar');
617617

618618
$hiddenMaxSizeMatcher1 = $this->matchField(['value' => 102400], 'hidden', 'MAX_FILE_SIZE');
619-
$hiddenMaxSizeMatcher2 = $this->matchField([[]], 'hidden', 'MAX_FILE_SIZE');
619+
$hiddenMaxSizeMatcher2 = $this->matchField([], 'hidden', 'MAX_FILE_SIZE');
620620

621621
$this->assertControlGroup($input1);
622622
$this->assertHTML($matcher1, $input1);

tests/MethodDispatcherTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@
33

44
use Former\TestCases\FormerTests;
55
use Mockery;
6-
use PHPUnit_Framework_Assert;
76
use ReflectionMethod;
87

98
class MethodDispatcherTest extends FormerTests
109
{
1110
public function testCanAddRepositories()
1211
{
1312
$dispatcher = new MethodDispatcher($this->app, array());
14-
$this->assertCount(0, PHPUnit_Framework_Assert::readAttribute($dispatcher, 'repositories'));
13+
14+
$reflector = new \ReflectionClass($dispatcher);
15+
$attribute = $reflector->getProperty('repositories');
16+
$attribute->setAccessible(true);
17+
18+
$this->assertCount(0, $attribute->getValue($dispatcher));
1519

1620
$dispatcher->addRepository('A\Namespace\\');
17-
$this->assertCount(1, PHPUnit_Framework_Assert::readAttribute($dispatcher, 'repositories'));
18-
$this->assertContains('A\Namespace\\', PHPUnit_Framework_Assert::readAttribute($dispatcher, 'repositories'));
21+
$this->assertCount(1, $attribute->getValue($dispatcher));
22+
$this->assertContains('A\Namespace\\', $attribute->getValue($dispatcher));
1923
}
2024

2125
/**

0 commit comments

Comments
 (0)