Skip to content

Commit

Permalink
Merge pull request #595 from formers/laravel-8
Browse files Browse the repository at this point in the history
  • Loading branch information
stayallive authored Sep 23, 2020
2 parents 2fcc1f6 + 5dda9f8 commit 625e1db
Show file tree
Hide file tree
Showing 24 changed files with 724 additions and 73 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Development
.idea
.phpunit.result.cache

# Dependencies
composer.lock
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: php

php:
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

# This triggers builds to run on the new TravisCI infrastructure.
Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
}
],
"require": {
"php": ">=5.4.0",
"php": ">=7.2.0",
"anahkiasen/html-object": "~1.4",
"illuminate/config": "~5.0|^6.0|^7.0",
"illuminate/container": "~5.0|^6.0|^7.0",
"illuminate/http": "~5.0|^6.0|^7.0",
"illuminate/routing": "~5.0|^6.0|^7.0",
"illuminate/session": "~5.0|^6.0|^7.0",
"illuminate/translation": "~5.0|^6.0|^7.0",
"illuminate/support": "~5.0|^6.0|^7.0"
"illuminate/config": "~5.0|^6.0|^7.0|^8.0",
"illuminate/container": "~5.0|^6.0|^7.0|^8.0",
"illuminate/http": "~5.0|^6.0|^7.0|^8.0",
"illuminate/routing": "~5.0|^6.0|^7.0|^8.0",
"illuminate/session": "~5.0|^6.0|^7.0|^8.0",
"illuminate/translation": "~5.0|^6.0|^7.0|^8.0",
"illuminate/support": "~5.0|^6.0|^7.0|^8.0"
},
"require-dev": {
"phpunit/phpunit": "~4",
"mockery/mockery": "~0.9.1",
"illuminate/database": "~5.0|^6.0|^7.0"
"phpunit/phpunit": "^8.5",
"mockery/mockery": "^1.3",
"illuminate/database": "~5.0|^6.0|^7.0|^8.0"
},
"autoload": {
"psr-4": {
Expand Down
34 changes: 16 additions & 18 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">

<testsuites>
<testsuite name="Former Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Former Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
4 changes: 3 additions & 1 deletion tests/Fields/CheckboxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public function testCanPushCheckboxesWithoutLabels()
$html = $this->former->label('<b>Views per Page</b>')->render();
$html .= $this->former->checkbox('per_page')->class('input')->render();

$this->assertInternalType('string', $html);
$this->assertIsString($html);
}

public function testDisabled()
Expand All @@ -606,6 +606,8 @@ public function testToStringMagicMethodShouldOnlyReturnString()
$this->former->group();
$output = $this->former->checkbox('foo')->text('bar').'';
$this->former->closeGroup();

$this->assertIsString($output);
}

public function testCanBeManualyDefinied()
Expand Down
2 changes: 2 additions & 0 deletions tests/Fields/ChoiceCheckboxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,5 +431,7 @@ public function testToStringMagicMethodShouldOnlyReturnString()
$this->former->group();
$output = $this->choiceCheckbox()->choices(array('foo')).'';
$this->former->closeGroup();

$this->assertIsString($output);
}
}
2 changes: 2 additions & 0 deletions tests/Fields/ChoiceRadioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,5 +431,7 @@ public function testToStringMagicMethodShouldOnlyReturnString()
$this->former->group();
$output = $this->choiceRadio()->choices(array('foo')).'';
$this->former->closeGroup();

$this->assertIsString($output);
}
}
8 changes: 4 additions & 4 deletions tests/Fields/ChoiceSelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public function testCanRenderSelectsDynamically()
$html[] = $this->former->choice('frmVehicleMake')->label('Make')->choices($this->choices)->wrapAndRender();

$results = implode(' ', $html);
$this->assertContains('control-group', $results);
$this->assertStringContainsString('control-group', $results);
}

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

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

public function testCanCreateSelectGroups()
Expand Down Expand Up @@ -528,6 +528,6 @@ public function testSelectCanPickRightOptionWithOptgroups()
$select = $this->former->choice('category_id')->choices($items)->value(1);
$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>';

$this->assertContains($matcher, $select->render());
$this->assertStringContainsString($matcher, $select->render());
}
}
2 changes: 1 addition & 1 deletion tests/Fields/HiddenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public function testCanPopulateHiddenFields()
public function testEncodedValue()
{
$input = $this->former->hidden('foo')->value('<a>bar</a>')->__toString();
$this->assertContains('value="&lt;a&gt;bar&lt;/a&gt;"', $input);
$this->assertStringContainsString('value="&lt;a&gt;bar&lt;/a&gt;"', $input);
}
}
2 changes: 1 addition & 1 deletion tests/Fields/InputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function testCanCreateNumberRange()
{
$range = $this->former->number('foo')->range(1, 5)->__toString();

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

public function testLabelCastsToString()
Expand Down
4 changes: 3 additions & 1 deletion tests/Fields/RadioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public function testInlineRadiosAreRendered()

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

$this->assertInternalType('string', $radio);
$this->assertIsString($radio);
}

public function testDisabled()
Expand All @@ -336,6 +336,8 @@ public function testToStringMagicMethodShouldOnlyReturnString()
$this->former->group();
$output = $this->former->radio('foo')->text('bar').'';
$this->former->closeGroup();

$this->assertIsString($output);
}

public function testCanBeManualyDefinied()
Expand Down
12 changes: 6 additions & 6 deletions tests/Fields/SelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public function testCanRenderSelectsDynamically()
$html[] = $this->former->select('frmVehicleMake')->label('Make')->options($this->options)->wrapAndRender();

$results = implode(' ', $html);
$this->assertContains('control-group', $results);
$this->assertStringContainsString('control-group', $results);
}

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

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

public function testCanCreateSelectGroups()
Expand Down Expand Up @@ -481,8 +481,8 @@ public function testOptionsSelectActsTheSameAsSelect()

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

$this->assertContains($matcher, $select2);
$this->assertContains($matcher, $select);
$this->assertStringContainsString($matcher, $select2);
$this->assertStringContainsString($matcher, $select);
}

public function testCanRepopulateFromPostArrayNotation()
Expand Down Expand Up @@ -540,6 +540,6 @@ public function testSelectCanPickRightOptionWithOptgroups()
$select = $this->former->select('category_id')->options($items, 1);
$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>';

$this->assertContains($matcher, $select->render());
$this->assertStringContainsString($matcher, $select->render());
}
}
2 changes: 1 addition & 1 deletion tests/Framework/NudeFrameworkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class NudeFrameworkTest extends FormerTests
{

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
4 changes: 2 additions & 2 deletions tests/Framework/TwitterBootstrap3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class TwitterBootstrap3Test extends FormerTests
{

public function setUp()
public function setUp(): void
{
parent::setUp();

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

$this->assertContains($matcher, $button);
$this->assertStringContainsString($matcher, $button);
}
}
4 changes: 2 additions & 2 deletions tests/Framework/TwitterBootstrap4Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class TwitterBootstrap4Test extends FormerTests
{

public function setUp()
public function setUp(): void
{
parent::setUp();

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

$this->assertContains($matcher, $button);
$this->assertStringContainsString($matcher, $button);
}
}
2 changes: 1 addition & 1 deletion tests/Framework/TwitterBootstrapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class TwitterBootstrapTest extends FormerTests
{

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
4 changes: 2 additions & 2 deletions tests/Framework/ZurbFramework4Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class ZurbFramework4Test extends FormerTests
{

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -63,7 +63,7 @@ public function testCanAppendHelpTexts()

public function testCantUseBootstrapReservedMethods()
{
$this->setExpectedException('BadMethodCallException');
$this->expectException('BadMethodCallException');

$this->former->text('foo')->blockHelp('bar')->__toString();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Framework/ZurbFramework5Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class ZurbFramework5Test extends FormerTests
{

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -63,7 +63,7 @@ public function testCanAppendHelpTexts()

public function testCantUseBootstrapReservedMethods()
{
$this->setExpectedException('BadMethodCallException');
$this->expectException('BadMethodCallException');

$this->former->text('foo')->blockHelp('bar')->__toString();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Framework/ZurbFrameworkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class ZurbFrameworkTest extends FormerTests
{

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -62,7 +62,7 @@ public function testCanAppendHelpTexts()

public function testCantUseBootstrapReservedMethods()
{
$this->setExpectedException('BadMethodCallException');
$this->expectException('BadMethodCallException');

$this->former->text('foo')->blockHelp('bar')->__toString();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,14 @@ public function testFieldsInCustomGroupsAreRawByDefault()
$this->former->group('foobar');
$test = $this->former->text('foobar')->__toString();

$this->assertNotContains('control-group', $test);
$this->assertStringNotContainsString('control-group', $test);
}

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

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

public function testCloseUnopenedGroup()
Expand Down
2 changes: 1 addition & 1 deletion tests/LiveValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ public function testNoMaxFileOnSecondFile()
$matcher2 = $this->matchField([], 'file', 'bar');

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

$this->assertControlGroup($input1);
$this->assertHTML($matcher1, $input1);
Expand Down
12 changes: 8 additions & 4 deletions tests/MethodDispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@

use Former\TestCases\FormerTests;
use Mockery;
use PHPUnit_Framework_Assert;
use ReflectionMethod;

class MethodDispatcherTest extends FormerTests
{
public function testCanAddRepositories()
{
$dispatcher = new MethodDispatcher($this->app, array());
$this->assertCount(0, PHPUnit_Framework_Assert::readAttribute($dispatcher, 'repositories'));

$reflector = new \ReflectionClass($dispatcher);
$attribute = $reflector->getProperty('repositories');
$attribute->setAccessible(true);

$this->assertCount(0, $attribute->getValue($dispatcher));

$dispatcher->addRepository('A\Namespace\\');
$this->assertCount(1, PHPUnit_Framework_Assert::readAttribute($dispatcher, 'repositories'));
$this->assertContains('A\Namespace\\', PHPUnit_Framework_Assert::readAttribute($dispatcher, 'repositories'));
$this->assertCount(1, $attribute->getValue($dispatcher));
$this->assertContains('A\Namespace\\', $attribute->getValue($dispatcher));
}

/**
Expand Down
Loading

0 comments on commit 625e1db

Please sign in to comment.