Skip to content

Commit

Permalink
Bump up PHP version constraint.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Oct 17, 2020
1 parent bc1be0e commit b1d8b60
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/phpunit.xml
/test/TestAsset/.cache/
/vendor/
.phpunit.result.cache
22 changes: 6 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,28 @@ env:
matrix:
fast_finish: true
include:
- php: 7.1
env:
- DEPS=lowest
- php: 7.1
env:
- DEPS=latest
- CS_CHECK=true
- TEST_COVERAGE=true
- php: 7.2
env:
- DEPS=lowest
- php: 7.2
env:
- DEPS=latest
- php: 7.3
env:
- DEPS=lowest
- php: 7.3
env:
- DEPS=latest
- CS_CHECK=true
- TEST_COVERAGE=true
- php: 7.4
env:
- DEPS=lowest
- php: 7.4
env:
- DEPS=latest
- php: 'nightly'
env:
- DEPS=latest

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
- if [[ $TEST_COVERAGE != 'true' && $TRAVIS_PHP_VERSION != 'nightly' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi

install:
- travis_retry composer install $COMPOSER_ARGS
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}
},
"require": {
"php": "^7.1",
"php": "^7.3 || ^8.0",
"laminas/laminas-zendframework-bridge": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
Expand All @@ -41,10 +41,11 @@
"ext-curl": "*",
"ext-dom": "*",
"ext-libxml": "*",
"http-interop/http-factory-tests": "^0.5.0",
"http-interop/http-factory-tests": "^0.7.0",
"laminas/laminas-coding-standard": "~1.0.0",
"php-http/psr7-integration-tests": "^1.0",
"phpunit/phpunit": "^7.5.18"
"php-http/psr7-integration-tests": "^1.1",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.1"
},
"provide": {
"psr/http-factory-implementation": "1.0",
Expand Down
3 changes: 3 additions & 0 deletions test/RelativeStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Laminas\Diactoros\Stream;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use RuntimeException;

use const SEEK_SET;
Expand All @@ -23,6 +24,8 @@
*/
class RelativeStreamTest extends TestCase
{
use ProphecyTrait;

public function testToString()
{
$decorated = $this->prophesize(Stream::class);
Expand Down
8 changes: 4 additions & 4 deletions test/Request/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function testSerializesRequestWithBody()
->withBody($stream);

$message = Serializer::toString($request);
$this->assertContains("POST /foo/bar HTTP/1.1\r\n", $message);
$this->assertContains("\r\n\r\n" . $body, $message);
$this->assertStringContainsString("POST /foo/bar HTTP/1.1\r\n", $message);
$this->assertStringContainsString("\r\n\r\n" . $body, $message);
}

public function testSerializesMultipleHeadersCorrectly()
Expand All @@ -67,8 +67,8 @@ public function testSerializesMultipleHeadersCorrectly()
->withAddedHeader('X-Foo-Bar', 'Bat');

$message = Serializer::toString($request);
$this->assertContains("X-Foo-Bar: Baz", $message);
$this->assertContains("X-Foo-Bar: Bat", $message);
$this->assertStringContainsString("X-Foo-Bar: Baz", $message);
$this->assertStringContainsString("X-Foo-Bar: Bat", $message);
}

public function originForms()
Expand Down
4 changes: 2 additions & 2 deletions test/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public function testGetHeadersContainsHostHeaderIfUriWithHostIsPresent()
$request = new Request('http://example.com');
$headers = $request->getHeaders();
$this->assertArrayHasKey('Host', $headers);
$this->assertContains('example.com', $headers['Host']);
$this->assertStringContainsString('example.com', $headers['Host'][0]);
}

/**
Expand Down Expand Up @@ -421,7 +421,7 @@ public function testGetHostHeaderLineReturnsUriHostWhenPresent()
{
$request = new Request('http://example.com');
$header = $request->getHeaderLine('host');
$this->assertContains('example.com', $header);
$this->assertStringContainsString('example.com', $header);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions test/Response/HtmlResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
use Laminas\Diactoros\Response\HtmlResponse;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\StreamInterface;
use Prophecy\PhpUnit\ProphecyTrait;

class HtmlResponseTest extends TestCase
{
use ProphecyTrait;

public function testConstructorAcceptsHtmlString()
{
$body = '<html>Uh oh not found</html>';
Expand Down
2 changes: 1 addition & 1 deletion test/Response/JsonResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function testUsesSaneDefaultJsonEncodingFlags($value, $key)
$contents = (string) $stream;

$expected = json_encode($value, $defaultFlags);
$this->assertContains(
$this->assertStringContainsString(
$expected,
$contents,
sprintf('Did not encode %s properly; expected (%s), received (%s)', $key, $expected, $contents)
Expand Down
6 changes: 3 additions & 3 deletions test/Response/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function testSerializesMultipleHeadersCorrectly()
->withAddedHeader('X-Foo-Bar', 'Bat');

$message = Serializer::toString($response);
$this->assertContains("X-Foo-Bar: Baz", $message);
$this->assertContains("X-Foo-Bar: Bat", $message);
$this->assertStringContainsString("X-Foo-Bar: Baz", $message);
$this->assertStringContainsString("X-Foo-Bar: Bat", $message);
}

public function testOmitsReasonPhraseFromStatusLineIfEmpty()
Expand All @@ -68,7 +68,7 @@ public function testOmitsReasonPhraseFromStatusLineIfEmpty()
$response->getBody()->write('Content!');

$message = Serializer::toString($response);
$this->assertContains("HTTP/1.1 299\r\n", $message);
$this->assertStringContainsString("HTTP/1.1 299\r\n", $message);
}

public function testCanDeserializeBasicResponse()
Expand Down
3 changes: 3 additions & 0 deletions test/Response/TextResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
use Laminas\Diactoros\Response\TextResponse;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\StreamInterface;
use Prophecy\PhpUnit\ProphecyTrait;

class TextResponseTest extends TestCase
{
use ProphecyTrait;

public function testConstructorAcceptsBodyAsString()
{
$body = 'Uh oh not found';
Expand Down
3 changes: 3 additions & 0 deletions test/Response/XmlResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
use Laminas\Diactoros\Response\XmlResponse;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\StreamInterface;
use Prophecy\PhpUnit\ProphecyTrait;

use const PHP_EOL;

class XmlResponseTest extends TestCase
{
use ProphecyTrait;

public function testConstructorAcceptsBodyAsString()
{
$body = 'Super valid XML';
Expand Down
18 changes: 14 additions & 4 deletions test/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use InvalidArgumentException;
use Laminas\Diactoros\Uri;
use PHPUnit\Framework\TestCase;
use ReflectionObject;

use function sprintf;

Expand Down Expand Up @@ -468,10 +469,19 @@ public function testMutationResetsUriStringPropertyInClone($method, $value)
{
$uri = new Uri('http://example.com/path?query=string#fragment');
$string = (string) $uri;
$this->assertAttributeSame($string, 'uriString', $uri);

$r = new ReflectionObject($uri);
$p = $r->getProperty('uriString');
$p->setAccessible(true);
$this->assertSame($string, $p->getValue($uri));

$test = $uri->{$method}($value);
$this->assertAttributeInternalType('null', 'uriString', $test);
$this->assertAttributeSame($string, 'uriString', $uri);
$r2 = new ReflectionObject($uri);
$p2 = $r2->getProperty('uriString');
$p2->setAccessible(true);
$this->assertNull($p2->getValue($test));

$this->assertSame($string, $p->getValue($uri));
}

/**
Expand Down Expand Up @@ -662,7 +672,7 @@ public function testReservedCharsInPathUnencoded()
->withHost('api.linkedin.com')
->withPath('/v1/people/~:(first-name,last-name,email-address,picture-url)');

$this->assertContains('/v1/people/~:(first-name,last-name,email-address,picture-url)', (string) $uri);
$this->assertStringContainsString('/v1/people/~:(first-name,last-name,email-address,picture-url)', (string) $uri);
}

public function testHostIsLowercase()
Expand Down

0 comments on commit b1d8b60

Please sign in to comment.