summaryrefslogtreecommitdiff
path: root/tests/examplefiles/test.php
diff options
context:
space:
mode:
authorMiikka Salminen <miikka.salminen@gmail.com>2016-02-03 21:28:17 +0200
committerMiikka Salminen <miikka.salminen@gmail.com>2016-02-03 21:28:17 +0200
commit3dfdf1ec1a679fa7ad2749ca85f0e2c3f23f8460 (patch)
tree48ecccd46e14a384c81265c30de53d0c02ed1caa /tests/examplefiles/test.php
parenta109fab994438a6323df468f1e16c5a1387008fc (diff)
downloadpygments-3dfdf1ec1a679fa7ad2749ca85f0e2c3f23f8460.tar.gz
Adds an entry to changelog. Adds magic method and variable lexing for PHP along with corresponding changes in a test file.
Diffstat (limited to 'tests/examplefiles/test.php')
-rw-r--r--tests/examplefiles/test.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/examplefiles/test.php b/tests/examplefiles/test.php
index 2ce4023e..794961c1 100644
--- a/tests/examplefiles/test.php
+++ b/tests/examplefiles/test.php
@@ -505,6 +505,30 @@ function &byref() {
return $x;
}
+// Test highlighting of magic methods and variables
+class MagicClass {
+ public $magic_str;
+ public $ordinary_str;
+
+ public function __construct($some_var) {
+ $this->magic_str = __FILE__;
+ $this->ordinary_str = $some_var;
+ }
+
+ public function __toString() {
+ return $this->magic_str;
+ }
+
+ public function nonMagic() {
+ return $this->ordinary_str;
+ }
+}
+
+$magic = new MagicClass(__DIR__);
+__toString();
+$magic->nonMagic();
+$magic->__toString();
+
echo <<<EOF
Test the heredocs...