Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
feat : added space to http header line
Browse files Browse the repository at this point in the history
feat : upgraded php to 7.4.2
  • Loading branch information
prisis committed Feb 4, 2020
1 parent 9873f63 commit c2d0a69
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: "Setup PHP"
uses: shivammathur/[email protected]
with:
php-version: "7.4"
php-version: "7.4.2"
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, sodium, curl, pdo, pdo_sqlite, inotify, pcntl, posix, xdebug
ini-values: pcov.directory=api, date.timezone=Europe/Berlin, opcache.enable_cli=1, serialize_precision=14
coverage: none
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/coding-standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ jobs:
- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: 7.4
php-version: "7.4.2"
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo
tools: composer, composer-prefetcher, cs2pr

- name: "Install Narrowspark coding standard"
run: composer global require narrowspark/coding-standard:3.4.0 --no-interaction --no-progress --profile --no-suggest --optimize-autoloader
run: |
composer global require narrowspark/coding-standard:3.4.0 --no-interaction --no-progress --profile --no-suggest --optimize-autoloader
# can be removed if bug with ClassAttributesSeparationFixer is fixed in newer version
composer global require friendsofphp/php-cs-fixer:2.16.x-dev
- name: "lint php code"
run: |
cd $GITHUB_WORKSPACE
/home/runner/.composer/vendor/bin/php-cs-fixer fix --config=$GITHUB_WORKSPACE/.php_cs -v --dry-run --stop-on-violation --format=checkstyle | cs2pr
/home/runner/.composer/vendor/bin/php-cs-fixer fix --config=$GITHUB_WORKSPACE/.php_cs -v --dry-run --format=checkstyle | cs2pr
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ["7.4"]
php-versions: ["7.4.2"]
dependencies: ["highest", "lowest"]

name: "PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} OS and with ${{ matrix.dependencies }} dependencies"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [windows-latest]
php-versions: ["7.4"]
php-versions: ["7.4.2"]
dependencies: ["highest", "lowest"]

name: "PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} OS and with ${{ matrix.dependencies }} dependencies"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
max-parallel: 2
matrix:
operating-system: [ubuntu-latest]
php-versions: ["7.4"]
php-versions: ["7.4.2"]
dependencies: ["highest", "lowest"]

name: "Audit on PHP ${{ matrix.php-versions }} and ${{ matrix.operating-system }} OS"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: "Setup PHP"
uses: shivammathur/[email protected]
with:
php-version: 7.4
php-version: "7.4.2"
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, inotify, pcntl, posix
pecl: true
tools: composer, composer-prefetcher, cs2pr
Expand Down
2 changes: 1 addition & 1 deletion src/Viserio/Component/Http/AbstractMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function getHeaderLine($name): string
return '';
}

return \implode(',', $value);
return \implode(', ', $value);
}

/**
Expand Down
17 changes: 13 additions & 4 deletions src/Viserio/Component/Http/Tests/AbstractMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ public static function provideValidHeaderCases(): iterable
// Description => [header name, header value, getHeader(), getHeaderLine()],
'Basic: value' => ['Basic', 'value', ['value'], 'value'],
'array value' => ['Basic', ['value'], ['value'], 'value'],
'two value' => ['Basic', ['value1', 'value2'], ['value1', 'value2'], 'value1,value2'],
'two value' => ['Basic', ['value1', 'value2'], ['value1', 'value2'], 'value1, value2'],
'empty header value' => ['Bar', '', [''], ''],
'array value with key' => ['foo', ['foo' => 'text/plain', 'bar' => 'application/json'], ['text/plain', 'application/json'], 'text/plain,application/json'],
'array value with key' => ['foo', ['foo' => 'text/plain', 'bar' => 'application/json'], ['text/plain', 'application/json'], 'text/plain, application/json'],
'Header with int' => ['HTTP__1', 'test', ['test'], 'test'],
'Int header' => [1, 'test', ['test'], 'test'],
['key', 'allowed key', ['allowed key'], 'allowed key'],
Expand Down Expand Up @@ -326,9 +326,18 @@ public function testContainsNotAllowedCharsOnHeaderField($header): void
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(\sprintf('[%s] is not a valid HTTP header field name.', $header));

$request = $this->classToTest;
$message = $this->classToTest;

$message->withHeader($header, 'value');
}

public function testWithAddedHeaderArrayValueAndKeys(): void
{
$message = $this->classToTest->withAddedHeader('list', ['foo' => 'one']);
$message = $message->withAddedHeader('list', ['foo' => 'two', 'bar' => 'three']);

$request->withHeader($header, 'value');
$headerLine = $message->getHeaderLine('list');
self::assertSame('one, two, three', $headerLine);
}

public static function provideContainsNotAllowedCharsOnHeaderFieldCases(): iterable
Expand Down
2 changes: 1 addition & 1 deletion src/Viserio/Component/Http/Tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ public function testCanGetHeaderAsCsv(): void
'Foo' => ['a', 'b', 'c'],
]);

self::assertEquals('a,b,c', $request->getHeaderLine('Foo'));
self::assertEquals('a, b, c', $request->getHeaderLine('Foo'));
self::assertEquals('', $request->getHeaderLine('Bar'));
}

Expand Down
8 changes: 4 additions & 4 deletions src/Viserio/Component/Http/Tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function testCanConstructWithHeadersAsArray(): void
]);

self::assertSame(['Foo' => ['baz', 'bar']], $response->getHeaders());
self::assertSame('baz,bar', $response->getHeaderLine('Foo'));
self::assertSame('baz, bar', $response->getHeaderLine('Foo'));
self::assertSame(['baz', 'bar'], $response->getHeader('Foo'));
}

Expand Down Expand Up @@ -315,7 +315,7 @@ public function testWithHeaderAsArray(): void

self::assertSame(['Foo' => ['Bar']], $response->getHeaders());
self::assertSame(['Foo' => ['Bar'], 'baZ' => ['Bam', 'Bar']], $response2->getHeaders());
self::assertSame('Bam,Bar', $response2->getHeaderLine('baz'));
self::assertSame('Bam, Bar', $response2->getHeaderLine('baz'));
self::assertSame(['Bam', 'Bar'], $response2->getHeader('baz'));
}

Expand All @@ -337,7 +337,7 @@ public function testWithAddedHeader(): void

self::assertSame(['Foo' => ['Bar']], $response->getHeaders());
self::assertSame(['Foo' => ['Bar', 'Baz']], $response2->getHeaders());
self::assertSame('Bar,Baz', $response2->getHeaderLine('foo'));
self::assertSame('Bar, Baz', $response2->getHeaderLine('foo'));
self::assertSame(['Bar', 'Baz'], $response2->getHeader('foo'));
}

Expand All @@ -348,7 +348,7 @@ public function testWithAddedHeaderAsArray(): void

self::assertSame(['Foo' => ['Bar']], $response->getHeaders());
self::assertSame(['Foo' => ['Bar', 'Baz', 'Bam']], $response2->getHeaders());
self::assertSame('Bar,Baz,Bam', $response2->getHeaderLine('foo'));
self::assertSame('Bar, Baz, Bam', $response2->getHeaderLine('foo'));
self::assertSame(['Bar', 'Baz', 'Bam'], $response2->getHeader('foo'));
}

Expand Down

0 comments on commit c2d0a69

Please sign in to comment.