Skip to content

Commit 75bf9b8

Browse files
Merge 6fcf924 into 428b63d
2 parents 428b63d + 6fcf924 commit 75bf9b8

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

.github/workflows/bc.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
on:
2-
pull_request:
3-
push:
2+
- pull_request
3+
- push
44

55
name: backwards compatibility
6+
67
jobs:
78
roave_bc_check:
8-
name: Roave BC Check
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@master
12-
- name: fetch tags
13-
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
14-
- name: Roave BC Check
15-
uses: docker://nyholm/roave-bc-check-ga
9+
uses: yiisoft/actions/.github/workflows/bc.yml@master
10+
with:
11+
os: >-
12+
['ubuntu-latest']
13+
php: >-
14+
['8.0']

.github/workflows/rector.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
os: >-
1919
['ubuntu-latest']
2020
php: >-
21-
['8.0']
21+
['8.1']

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"require-dev": {
3535
"maglnet/composer-require-checker": "^4.4",
3636
"phpunit/phpunit": "^9.5",
37-
"rector/rector": "^0.15.4",
37+
"rector/rector": "^0.16",
3838
"roave/infection-static-analysis-plugin": "^1.25",
3939
"spatie/phpunit-watcher": "^1.23",
4040
"vimeo/psalm": "^4.30|^5.4"

tests/ArrayHelper/GetValueTest.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use InvalidArgumentException;
99
use PHPUnit\Framework\TestCase;
1010
use stdClass;
11+
use Throwable;
1112
use Yiisoft\Arrays\ArrayHelper;
1213
use Yiisoft\Arrays\Tests\Objects\Magic;
1314
use Yiisoft\Arrays\Tests\Objects\Post1;
@@ -221,19 +222,25 @@ public function testGetNestedValueFromObjectFromArray(): void
221222
*/
222223
public function testGetValueNonexistingProperties1(): void
223224
{
224-
$this->expectError();
225-
$object = new Post1();
226-
$this->assertNull(ArrayHelper::getValue($object, 'nonExisting'));
225+
try {
226+
$object = new Post1();
227+
ArrayHelper::getValue($object, 'nonExisting');
228+
} catch (Throwable $e) {
229+
$this->assertSame('Undefined property: Yiisoft\Arrays\Tests\Objects\Post1::$nonExisting', $e->getMessage());
230+
}
227231
}
228232

229233
/**
230234
* This is expected to result in a PHP error.
231235
*/
232236
public function testGetValueNonexistingProperties2(): void
233237
{
234-
$this->expectError();
235-
$arrayObject = new ArrayObject(['id' => 23], ArrayObject::ARRAY_AS_PROPS);
236-
$this->assertEquals(23, ArrayHelper::getValue($arrayObject, 'nonExisting'));
238+
try {
239+
$arrayObject = new ArrayObject(['id' => 23], ArrayObject::ARRAY_AS_PROPS);
240+
ArrayHelper::getValue($arrayObject, 'nonExisting');
241+
} catch (Throwable $e) {
242+
$this->assertSame('Undefined array key "nonExisting"', $e->getMessage());
243+
}
237244
}
238245

239246
public function testGetValueFromStaticProperty(): void
@@ -246,12 +253,12 @@ public function testGetValueFromStaticProperty(): void
246253
public function testGetUndefinedPropertyFromObject(): void
247254
{
248255
$object = new stdClass();
249-
if (PHP_VERSION_ID >= 80000) {
250-
$this->expectWarning();
251-
} else {
252-
$this->expectNotice();
256+
257+
try {
258+
ArrayHelper::getValue($object, 'var');
259+
} catch (Throwable $e) {
260+
$this->assertSame('Undefined property: stdClass::$var', $e->getMessage());
253261
}
254-
ArrayHelper::getValue($object, 'var');
255262
}
256263

257264
public function testExistingMagicObjectProperty(): void

0 commit comments

Comments
 (0)