Skip to content

Commit da64264

Browse files
committed
refactor: more tests, and test cleanup
1 parent 6d578be commit da64264

9 files changed

+29
-9
lines changed

Zend/tests/property_hooks/readonly_class_property_backed.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Backed property, readonly class
2+
Backed property in readonly class may have hooks
33
--FILE--
44
<?php
55

Zend/tests/property_hooks/readonly_class_property_backed_inheritance_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Backed property cannot redeclare readonly as non-readonly property
2+
Non-readonly class cannot extend readonly class
33
--FILE--
44
<?php
55

Zend/tests/property_hooks/readonly_class_property_backed_inheritance_2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Backed property cannot redeclare non-readonly as readonly property
2+
Readonly class cannot extend non-readonly class
33
--FILE--
44
<?php
55

Zend/tests/property_hooks/readonly_class_property_backed_promoted.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Backed property, promoted, readonly class
2+
Backed promoted property in readonly class may have hooks
33
--FILE--
44
<?php
55

Zend/tests/property_hooks/readonly_property_backed_inheritance_3.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Backed property cannot redeclare readonly as non-readonly property
2+
Backed readonly property get() in child class behaves as expected
33
--FILE--
44
<?php
55

@@ -53,14 +53,12 @@ try {
5353
echo $e->getMessage(), "\n";
5454
}
5555

56-
5756
try {
5857
$t->prop = 43; // cannot write, visibility
5958
} catch (Error $e) {
6059
echo $e->getMessage(), "\n";
6160
}
6261

63-
6462
?>
6563
--EXPECT--
6664
First call:

Zend/tests/property_hooks/readonly_property_backed_trait_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Backed property cannot redeclare readonly as non-readonly property
2+
Readonly class Test cannot use trait with a non-readonly property
33
--FILE--
44
<?php
55

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Virtual readonly property in interface throws
3+
--FILE--
4+
<?php
5+
6+
abstract class Test {
7+
public readonly int $prop { get; }
8+
}
9+
?>
10+
--EXPECTF--
11+
Fatal error: Hooked virtual properties cannot be readonly in %s on line %d

Zend/tests/property_hooks/readonly_property_virtual.phpt renamed to Zend/tests/property_hooks/readonly_property_virtual_in_class.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Virtual readonly property cannot have hooks
2+
Virtual readonly property in class throws
33
--FILE--
44
<?php
55

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Virtual readonly property in interface throws
3+
--FILE--
4+
<?php
5+
6+
interface Test {
7+
public readonly int $prop { get; }
8+
}
9+
?>
10+
--EXPECTF--
11+
Fatal error: Hooked virtual properties cannot be readonly in %s on line %d

0 commit comments

Comments
 (0)