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
2 changes: 1 addition & 1 deletion php/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"ext-protobuf": "*"
},
"require-dev": {
"phpunit/phpunit": ">=5.0.0 <8.5.27"
"phpunit/phpunit": ">=10.5.62 <11.0.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion php/composer.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"php": ">=7.0.0"
},
"require-dev": {
"phpunit/phpunit": ">=5.0.0"
"phpunit/phpunit": ">=10.5.62 <11.0.0"
},
"suggest": {
"ext-bcmath": "Need to support JSON deserialization"
Expand Down
2 changes: 1 addition & 1 deletion php/tests/EncodeDecodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ public function testWrapperSetUnwrappedJsonEncode(
$this->assertEquals($defaultValue, $to->getOneofFieldUnwrapped());
}

public function wrappersDataProvider()
public static function wrappersDataProvider()
{
return [
[TestInt32Value::class, 1, "1", 0, "0"],
Expand Down
12 changes: 6 additions & 6 deletions php/tests/GeneratedClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1943,15 +1943,15 @@ public function testSpecialCharacters()
$this->assertEquals(' */', array_pop($commentLines));
$docComment = implode("\n", $commentLines);
// test special characters
$this->assertContains(";,/?:&=+$-_.!~*'()", $docComment);
$this->assertStringContainsString(";,/?:&=+$-_.!~*'()", $docComment);
// test open doc comment
$this->assertContains('/*', $docComment);
$this->assertStringContainsString('/*', $docComment);
// test escaped closed doc comment
$this->assertNotContains('*/', $docComment);
$this->assertContains('{@*}', $docComment);
$this->assertStringNotContainsString('*/', $docComment);
$this->assertStringContainsString('{@*}', $docComment);
// test escaped at-sign
$this->assertContains('\@foo', $docComment);
$this->assertStringContainsString('\@foo', $docComment);
// test forwardslash on new line
$this->assertContains("* /\n", $docComment);
$this->assertStringContainsString("* /\n", $docComment);
}
}
8 changes: 4 additions & 4 deletions php/tests/GeneratedPhpdocTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function testPhpDocForConstructor()
{
$class = new ReflectionClass('Foo\TestMessage');
$doc = $class->getMethod('__construct')->getDocComment();
$this->assertStringContains('@param array $data', $doc);
$this->assertStringContains('@type int $optional_int32', $doc);
$this->assertStringContainsString('@param array $data', $doc);
$this->assertStringContainsString('@type int $optional_int32', $doc);
}

/**
Expand All @@ -30,11 +30,11 @@ public function testPhpDocForIntGetters($methods, $expectedDoc)
$class = new ReflectionClass('Foo\TestMessage');
foreach ($methods as $method) {
$doc = $class->getMethod($method)->getDocComment();
$this->assertStringContains($expectedDoc, $doc);
$this->assertStringContainsString($expectedDoc, $doc);
}
}

public function providePhpDocForGettersAndSetters()
public static function providePhpDocForGettersAndSetters()
{
return [
[
Expand Down
2 changes: 1 addition & 1 deletion php/tests/PhpImplementationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ public function testArrayConstructorWithNullValuesThrowsException($requestData)
$m = new TestMessage($requestData);
}

public function provideArrayConstructorWithNullValuesThrowsException()
public static function provideArrayConstructorWithNullValuesThrowsException()
{
return [
[['optional_int32' => null]],
Expand Down
8 changes: 7 additions & 1 deletion php/tests/PreviouslyGeneratedClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ class PreviouslyGeneratedClassTest extends TestBase
public function testPrefixForReservedWords()
{
// In newer versions of PHP, we cannot reference the old class name.
if (version_compare(phpversion(), '8.1.0', '>=')) return;
if (version_compare(phpversion(), '8.1.0', '>=')) {
$this->markTestSkipped('readonly is reserved in PHP >= 8.2');
};

// For older versions of PHP, verify that we can reference the
// original class name.
eval('
$m = new \Previous\readonly();
$this->assertTrue(true);
');

// If execution reaches this line, it means no exception was thrown.
// This assertion prevents PHPUnit from marking the test as risky.
$this->assertTrue(true);
}
}
10 changes: 5 additions & 5 deletions php/tests/WrapperTypeSettersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testGettersAndSetters(
}
}

public function gettersAndSettersDataProvider()
public static function gettersAndSettersDataProvider()
{
return [
[TestWrapperSetters::class, DoubleValue::class, "setDoubleValue", "setDoubleValueUnwrapped", "getDoubleValue", "getDoubleValueUnwrapped", [
Expand Down Expand Up @@ -155,7 +155,7 @@ public function testInvalidSetters($class, $setter, $value)
(new $class())->$setter($value);
}

public function invalidSettersDataProvider()
public static function invalidSettersDataProvider()
{
return [
[TestWrapperSetters::class, "setDoubleValueUnwrapped", "abc"],
Expand Down Expand Up @@ -212,7 +212,7 @@ public function testConstructorWithWrapperType($class, $wrapperClass, $wrapperFi
$this->assertEquals($expectedInstance->$getter()->getValue(), $actualInstance->$getter()->getValue());
}

public function constructorWithWrapperTypeDataProvider()
public static function constructorWithWrapperTypeDataProvider()
{
return [
[TestWrapperSetters::class, DoubleValue::class, 'double_value', 'getDoubleValue', 1.1],
Expand Down Expand Up @@ -247,7 +247,7 @@ public function testConstructorWithRepeatedWrapperType($wrapperField, $getter, $
$this->assertTrue(true);
}

public function constructorWithRepeatedWrapperTypeDataProvider()
public static function constructorWithRepeatedWrapperTypeDataProvider()
{
$sv7 = new StringValue(['value' => 'seven']);
$sv8 = new StringValue(['value' => 'eight']);
Expand Down Expand Up @@ -292,7 +292,7 @@ public function testConstructorWithMapWrapperType($wrapperField, $getter, $value
$this->assertTrue(true);
}

public function constructorWithMapWrapperTypeDataProvider()
public static function constructorWithMapWrapperTypeDataProvider()
{
$sv7 = new StringValue(['value' => 'seven']);
$sv8 = new StringValue(['value' => 'eight']);
Expand Down
Loading