Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22eb644

Browse files
committed
Added test for setting static properties
1 parent 99babba commit 22eb644

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/utils/ReflectionTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ public function testSetProperty() {
159159
$this->assertSame($expected_value, $this->example_object->get_value($property_name));
160160
}
161161

162+
public function testSetStaticProperty() {
163+
$property_name = 'example_static_property';
164+
$expected_value = uniqid();
165+
166+
$starting_value = example_class::get_static_value($property_name);
167+
reflection::set_property(example_class::class, $property_name, $expected_value);
168+
$new_value = example_class::get_static_value($property_name);
169+
170+
$this->assertNotSame($starting_value, $new_value);
171+
$this->assertSame($expected_value, $new_value);
172+
}
173+
162174
// These have to be seperate as data providers don't have access to things defined in setUp()
163175

164176
/**

0 commit comments

Comments
 (0)