stanley-king 7 vuotta sitten
vanhempi
commit
6e3f0605d0
1 muutettua tiedostoa jossa 40 lisäystä ja 0 poistoa
  1. 40 0
      test/TestPhpLang.php

+ 40 - 0
test/TestPhpLang.php

@@ -63,6 +63,41 @@ class A
     }
 }
 
+
+class StaticTest
+{
+    public function __call($method, $parameters)
+    {
+        if($method == "where") {
+            echo json_encode($parameters);
+        }
+        elseif($method == "field") {
+            echo json_encode($parameters);
+        }
+
+        return $this;
+    }
+    public function select()
+    {
+        echo "select";
+    }
+
+    /**
+     * Dynamically pass methods to the default connection.
+     *
+     * @param  string  $method
+     * @param  array   $parameters
+     * @return mixed
+     */
+    public static function __callStatic($method, $parameters)
+    {
+        if($method == "where") {
+            $obj = new StaticTest();
+            return $obj->where($method,$parameters);
+        }
+    }
+}
+
 class TestPhpLang extends PHPUnit_Framework_TestCase
 {
     public function testCart()
@@ -137,4 +172,9 @@ class TestPhpLang extends PHPUnit_Framework_TestCase
         $cl = $mem_cl->bindTo($ob1);
         echo $cl();
     }
+
+    public function testStaticCall()
+    {
+        StaticTest::where(['i am here'])->field()->select();
+    }
 }