12 private $internal = 1;
13 private function add($inc)
15 $this->
internal += $inc;
16 return $this->internal;
18 public function getInternal()
20 return $this->internal;
26 protected function setUp() :
void
28 $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
31 protected function tearDown() :
void
33 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
36 public function testInvokeObjectsMethodnameWith()
39 assertThat(Reflectory::invokeObjectsMethodnameWith($instanceWithPrivateMethod,
'add', array(2)),is(1+2));
40 assertThat(Reflectory::invokeObjectsMethodnameWith($instanceWithPrivateMethod,
'add', array(4)),is(1+2+4));
43 public function testGetObjectsProperty()
46 assertThat(Reflectory::getObjectsProperty($instanceWithPrivateMethod,
'internal'),is(1));
49 public function testSetObjectsProperty()
52 Reflectory::setObjectsProperty($instanceWithPrivateMethod,
'internal', 3);
53 assertThat($instanceWithPrivateMethod->getInternal(),is(3));