Skip to content

Commit

Permalink
Fix asymmetric visibility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Nov 2, 2024
1 parent d732885 commit 58fc79e
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/test/php/lang/reflection/unittest/PropertiesTest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,33 @@ public function set_accessing_failed_exceptions_target_member() {
}
}

#[Test, Condition(assert: 'self::$ASYMMETRIC'), Values(['public protected(set)', 'public private(set)', 'protected private(set)'])]
public function asymmetric_visibility($modifiers) {
$t= $this->declare('{ '.$modifiers.' int $fixture; }');
#[Test, Condition(assert: 'self::$ASYMMETRIC')]
public function asymmetric_visibility() {
$t= $this->declare('{ public protected(set) int $fixture; }');
Assert::equals(
'public protected(set) int $fixture',
$t->property('fixture')->toString()
);
}

#[Test, Condition(assert: 'self::$ASYMMETRIC'), Values(['public', 'protected'])]
public function asymmetric_visibility_with_same_get_set_folded($modifiers) {
$t= $this->declare('{ '.$modifiers.' '.$modifiers.'(set) int $fixture; }');
Assert::equals(
$modifiers.' int $fixture',
$t->property('fixture')->toString()
);
}

#[Test, Condition(assert: 'self::$ASYMMETRIC'), Values(['public', 'protected'])]
public function asymmetric_visibility_with_private_become_final($modifiers) {
$t= $this->declare('{ '.$modifiers.' private(set) int $fixture; }');
Assert::equals(
$modifiers.' final private(set) int $fixture',
$t->property('fixture')->toString()
);
}

#[Test, Condition(assert: 'self::$ASYMMETRIC'), Values(['public', 'protected', 'private'])]
public function set_implicit_when_same_as_get($modifier) {
$t= $this->declare('{ '.$modifier.' '.$modifier.'(set) int $fixture; }');
Expand Down

0 comments on commit 58fc79e

Please sign in to comment.