com php-src: Add tests for previous commit: ext/date/tests/call _function_from_method.phpt
| From: | Nikita Popov | Date: | Tue, 06 May 2014 20:04:58 +0000 |
| Subject: | com php-src: Add tests for previous commit: ext/date/tests/call _function_from_method.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78154@lists.php.net to get a copy of this message | ||
Commit: a9ba7a67793f3c5f8bbd423677c61747409777c3
Author: Nikita Popov <nikic@php.net> Tue, 6 May 2014 22:04:58 +0200
Parents: 4d8c59f0da439f52a31121a101eef0e5a0faf973
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a9ba7a67793f3c5f8bbd423677c61747409777c3
Log:
Add tests for previous commit
Changed paths:
A ext/date/tests/call_function_from_method.phpt
Diff:
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 0000000..7cbe684
--- /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--
+<?php
+
+class Date {
+ public function __construct($in) {
+ $this->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"