File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ public function __isset(string $name): bool
156156 {
157157 try {
158158 return $ this ->__get ($ name ) !== null ;
159- } catch (Throwable ) {
159+ } catch (InvalidCallException | UnknownPropertyException ) {
160160 return false ;
161161 }
162162 }
Original file line number Diff line number Diff line change 44
55namespace Yiisoft \ActiveRecord \Tests ;
66
7+ use DivisionByZeroError ;
78use ReflectionException ;
89use Yiisoft \ActiveRecord \ActiveQuery ;
910use Yiisoft \ActiveRecord \Tests \Stubs \ActiveRecord \Animal ;
@@ -392,7 +393,8 @@ public function testIssetException(): void
392393
393394 $ cat = new Cat ($ this ->db );
394395
395- $ this ->assertFalse (isset ($ cat ->exception ));
396+ $ this ->expectException (Exception::class);
397+ isset ($ cat ->exception );
396398 }
397399
398400 public function testIssetThrowable (): void
@@ -401,7 +403,18 @@ public function testIssetThrowable(): void
401403
402404 $ cat = new Cat ($ this ->db );
403405
404- $ this ->assertFalse (isset ($ cat ->throwable ));
406+ $ this ->expectException (DivisionByZeroError::class);
407+ isset ($ cat ->throwable );
408+ }
409+
410+ public function testIssetNonExisting (): void
411+ {
412+ $ this ->checkFixture ($ this ->db , 'cat ' );
413+
414+ $ cat = new Cat ($ this ->db );
415+
416+ $ this ->assertFalse (isset ($ cat ->non_existing ));
417+ $ this ->assertFalse (isset ($ cat ->non_existing_property ));
405418 }
406419
407420 public function testSetAttributes (): void
Original file line number Diff line number Diff line change @@ -29,4 +29,8 @@ public function getThrowable(): float|int
2929 {
3030 return 5 /0 ;
3131 }
32+
33+ public function setNonExistingProperty (string $ value ): void
34+ {
35+ }
3236}
You can’t perform that action at this time.
0 commit comments