Raise version min PHP 7.3.

This commit is contained in:
Wilmer Arambula
2024-03-20 17:27:20 -03:00
parent e2a167028b
commit ce813e5060
189 changed files with 1901 additions and 1586 deletions

View File

@ -20,7 +20,7 @@ use yiiunit\TestCase;
*/
class ArrayHelperTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
@ -136,14 +136,12 @@ class ArrayHelperTest extends TestCase
}
/**
* @requires PHP < 8.1
*
* @return void
*/
public function testRemoveWithFloat()
{
if (version_compare(PHP_VERSION, '8.1.0', '>=')) {
$this->markTestSkipped('Using floats as array key is deprecated.');
}
$array = ['name' => 'b', 'age' => 3, 1.1 => null];
$name = ArrayHelper::remove($array, 'name');
@ -527,14 +525,12 @@ class ArrayHelperTest extends TestCase
}
/**
* @requires PHP < 8.1
*
* @see https://github.com/yiisoft/yii2/pull/11549
*/
public function testGetValueWithFloatKeys()
{
if (version_compare(PHP_VERSION, '8.1.0', '>=')) {
$this->markTestSkipped('Using floats as array key is deprecated.');
}
$array = [];
$array[1.1] = 'some value';
$array[2.1] = null;
@ -754,12 +750,11 @@ class ArrayHelperTest extends TestCase
$this->assertFalse(ArrayHelper::keyExists('c', $array, false));
}
/**
* @requires PHP < 8.1
*/
public function testKeyExistsWithFloat()
{
if (version_compare(PHP_VERSION, '8.1.0', '>=')) {
$this->markTestSkipped('Using floats as array key is deprecated.');
}
$array = [
1 => 3,
2.2 => 4, // Note: Floats are cast to ints, which means that the fractional part will be truncated.
@ -876,13 +871,12 @@ class ArrayHelperTest extends TestCase
public function testGetValueNonexistingProperties1()
{
if (PHP_VERSION_ID < 80000) {
$this->expectException('PHPUnit_Framework_Error_Notice');
} else {
$this->expectException('PHPUnit_Framework_Error_Warning');
try {
$object = new Post1();
ArrayHelper::getValue($object, 'nonExisting');
} catch (\Throwable $th) {
$this->assertEquals('Undefined property: yiiunit\framework\helpers\Post1::$nonExisting', $th->getMessage());
}
$object = new Post1();
ArrayHelper::getValue($object, 'nonExisting');
}
public function testGetValueNonexistingPropertiesForArrayObject()