public function testStubbed() { // Basic example to show that \array_pop() is not actually called GlobalFunctions::register('array_pop', function ($array) { return 7; }); $array = [1, 2, 3, 4, 5]; $popped = GlobalFunctions::array_pop($array); $this->assertEquals(7, $popped, 'Stubbed result'); $this->assertEquals([1, 2, 3, 4, 5], $array, 'Unaltered array'); }