/** * @covers ::onObject */ public function testCanStaticallyCallPublicMethods() { // ---------------------------------------------------------------- // setup your test $target = new InvokeMethodTest_TargetClass(); $expectedResult = 40; // ---------------------------------------------------------------- // perform the change $actualResult = InvokeMethod::onObject($target, 'publicMethod', [10]); // ---------------------------------------------------------------- // test the results $this->assertEquals($expectedResult, $actualResult); }
/** * @covers ::getFromCache * @dataProvider provideDataForTheCache */ public function testReturnsNullIfNotInCache($key, $expectedValue) { // ---------------------------------------------------------------- // setup your test $cache = new CacheTypeA(); // make sure the underlying shared cache is EMPTY InvokeMethod::onClass(CacheTypeA::class, 'resetCache'); // ---------------------------------------------------------------- // perform the change // ---------------------------------------------------------------- // test the results $this->assertNull(InvokeMethod::onObject($cache, 'getFromCache', [$key])); }