From: Nikita Popov Date: Tue, 6 May 2014 20:04:58 +0000 (+0200) Subject: Add tests for previous commit X-Git-Tag: POST_PHPNG_MERGE~391 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9ba7a67793f3c5f8bbd423677c61747409777c3;p=php Add tests for previous commit --- diff --git a/ext/date/tests/call_function_from_method.phpt b/ext/date/tests/call_function_from_method.phpt new file mode 100644 index 0000000000..7cbe68481e --- /dev/null +++ b/ext/date/tests/call_function_from_method.phpt @@ -0,0 +1,29 @@ +--TEST-- +Call to date function from a method and call to date method from call_user_func +--INI-- +date.timezone=UTC +--FILE-- +date = date_create($in); + } + + public function getYear1() { + return date_format($this->date, 'Y'); + } + + public function getYear2() { + return call_user_func([$this->date, 'format'], 'Y'); + } +} + +$d = new Date('NOW'); +var_dump($d->getYear1()); +var_dump($d->getYear2()); + +?> +--EXPECTF-- +string(4) "%d" +string(4) "%d"