Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@
"brainmaestro/composer-git-hooks": "^2.8",
"extensions": {
"phpunit/phpunit": {
"fakerphp/faker": "1.20.*"
"fakerphp/faker": "1.24.*"
}
},
"friendsofphp/php-cs-fixer": "^3.3",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9",
"phpunit/phpunit": "^10",
"rector/rector": "^1.0",
"vimeo/psalm": "^5.23"
}
Expand Down
13 changes: 7 additions & 6 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="./tests/bootstrap.php" colors="true" convertDeprecationsToExceptions="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="./tests/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage/>
<testsuites>
<testsuite name="BigBlueButton unit test suite">
<directory>./tests/unit/</directory>
Expand All @@ -16,4 +12,9 @@
<directory>./tests/functional/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion tests/integration/Http/Transport/CurlTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function setUpBeforeClass(): void
}

/** @return array<string,array<int>> */
public function provideBadResponseCodes(): iterable
public static function provideBadResponseCodes(): iterable
{
// cURL does not understand codes below 200 properly.
// foreach (range(100, 199) as $badCode) {
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/Http/SetCookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function testMatchesDomain(): void
}

/** @return array<array<string|bool>> */
public function pathMatchProvider(): array
public static function pathMatchProvider(): array
{
return [
['/foo', '/foo', true],
Expand Down Expand Up @@ -182,7 +182,7 @@ public function testMatchesPath(string $cookiePath, string $requestPath, bool $i
}

/** @return array<array<string|bool>> */
public function cookieValidateProvider(): array
public static function cookieValidateProvider(): array
{
return [
['foo', 'baz', 'bar', true],
Expand Down Expand Up @@ -240,7 +240,7 @@ public function testConvertsToString(): void
*
* @return array<mixed>
*/
public function cookieParserDataProvider(): array
public static function cookieParserDataProvider(): array
{
return [
[
Expand Down Expand Up @@ -442,7 +442,7 @@ public function testParseCookie(array|string $cookie, array $parsed): void
*
* @return array<array<string|bool>>
*/
public function isExpiredProvider(): array
public static function isExpiredProvider(): array
{
return [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,23 @@ public function testRequestWithDefaultHeaders(): void
$this->requestFactoryMock->expects($this->once())->method('createRequest')->with('POST', 'https://example.com/')->willReturn($requestMock);
$this->streamFactoryMock->expects($this->once())->method('createStream')->with('Hi Doc!')->willReturn($requestStreamMock);
$requestMock->expects($this->once())->method('withBody')->with($requestStreamMock)->willReturn($requestMock);
$requestMock->expects($this->exactly(3))->method('withHeader')->withConsecutive(
['X-A-Custom-Header', 'Foo'],
['X-Another-Custom-Header', 'Bar'],
['Content-Type', 'application/xml']
)->willReturn($requestMock);
$matcher = $this->exactly(3);
$requestMock->expects($matcher)->method('withHeader')->willReturnCallback(function (...$parameters) use ($matcher, $requestMock) {
if ($matcher->numberOfInvocations() === 1) {
$this->assertSame('X-A-Custom-Header', $parameters[0]);
$this->assertSame('Foo', $parameters[1]);
}
if ($matcher->numberOfInvocations() === 2) {
$this->assertSame('X-Another-Custom-Header', $parameters[0]);
$this->assertSame('Bar', $parameters[1]);
}
if ($matcher->numberOfInvocations() === 3) {
$this->assertSame('Content-Type', $parameters[0]);
$this->assertSame('application/xml', $parameters[1]);
}

return $requestMock;
});
$this->httpClientMock->expects($this->once())->method('sendRequest')->with($requestMock)->willReturn($responseMock);
$responseMock->expects($this->exactly(2))->method('getStatusCode')->willReturn(200);
$responseMock->expects($this->once())->method('getHeader')->with('Set-Cookie')->willReturn(['JSESSIONID=MartyMcFlySession']);
Expand Down Expand Up @@ -199,7 +211,7 @@ public function testRequestWithClientException(): void
}

/** @return iterable<string,array<int>> */
public function provideBadResponseCodes(): iterable
public static function provideBadResponseCodes(): iterable
{
foreach (range(100, 199) as $badCode) {
yield 'HTTP code '.$badCode => [$badCode];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function testRequestWithDefaultOptions(): void
}

/** @return iterable<string,array<int>> */
public function provideBadResponseCodes(): iterable
public static function provideBadResponseCodes(): iterable
{
foreach (range(100, 199) as $badCode) {
yield 'HTTP code '.$badCode => [$badCode];
Expand Down Expand Up @@ -244,7 +244,7 @@ public function testRequestWithBadResponseCode(int $badCode): void
}

/** @return iterable<string,array<int|FakeClientException|FakeServerException|FakeRedirectionException>> */
public function provideBadResponseExceptions(): iterable
public static function provideBadResponseExceptions(): iterable
{
yield 'Client exception' => [new FakeClientException(), 400];
yield 'Server exception' => [new FakeServerException(), 500];
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Http/Transport/HeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testMergeCurlHeaders(): void
/**
* @return iterable<string[]>
*/
public function provideBadlyFormattedHeaders(): iterable
public static function provideBadlyFormattedHeaders(): iterable
{
yield ['This is not valid.'];
yield ['Foo:Bar'];
Expand All @@ -69,7 +69,7 @@ public function testMergeCurlHeadersWithBadHeaders(string $badHeader): void
/**
* @return iterable<mixed>
*/
public function provideNonStringHeaders(): iterable
public static function provideNonStringHeaders(): iterable
{
yield [123];
yield [false];
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Util/ArrayHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
final class ArrayHelperTest extends TestCase
{
/** @return iterable<string,array<string|array-key,string|bool>> */
public function provideArrays(): iterable
public static function provideArrays(): iterable
{
yield 'simple flat arrays' => [
['foo' => 'bar', 'foo2' => 'bar2'],
Expand Down
4 changes: 2 additions & 2 deletions tools/.phpunit/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"phpunit/phpunit": "^9.0",
"fakerphp/faker": "1.20.*"
"phpunit/phpunit": "^10.0",
"fakerphp/faker": "1.24.*"
}
}
Loading