public function testInvalidMethod() { if (!class_exists('Error')) { $this->markTestSkipped('Requires PHP 7'); } $fn = invoker('undefinedMethod'); $this->expectException('Error', 'Call to undefined method Functional\\Tests\\InvokerTest::undefinedMethod'); $fn($this); }
public function callbacks() { $dt = new DateTime(); $dt2 = clone $dt; $dateFormat = invoker('format', [DateTime::ATOM]); return [['Functional\\Tests\\add', [2, 4, 6, 8], 20, true], [['Functional\\Tests\\Adder', 'static_add'], [2, 4, 6, 8], 20, true], ['Functional\\Tests\\Adder::static_add', [2, 4, 6, 8], 20, true], [new Adder(), [2, 4, 6, 8], 20, true], [[new Adder(), 'add'], [2, 4, 6, 8], 20, true], [[new Adder(), 'static_add'], [2, 4, 6, 8], 20, true], ['number_format', [1.234, 2, ',', '\''], '1,23', false], [['DateTime', 'createFromFormat'], [DateTime::ATOM, $dt->format(DateTime::ATOM)], $dt, true, $dateFormat], ['DateTime::createFromFormat', [DateTime::ATOM, $dt->format(DateTime::ATOM)], $dt, true, $dateFormat], [[new DateTime(), 'createFromFormat'], [DateTime::ATOM, $dt->format(DateTime::ATOM)], $dt, true, $dateFormat], [[new DateTime(), 'setTime'], [10, 10], $dt2->setTime(10, 10), true, $dateFormat]]; }