소스 검색

add to local

stanley-king 7 년 전
부모
커밋
6e3f0605d0
1개의 변경된 파일40개의 추가작업 그리고 0개의 파일을 삭제
  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();
+    }
 }