]> granicus.if.org Git - php/commitdiff
add moar
authorkrakjoe <joe.watkins@live.co.uk>
Thu, 5 Dec 2013 12:23:49 +0000 (12:23 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Thu, 5 Dec 2013 12:23:49 +0000 (12:23 +0000)
tests/code/class.php [new file with mode: 0644]
tests/commands/0001_basic.test [moved from tests/basic.test with 100% similarity]
tests/commands/0002_set.test [moved from tests/set.test with 100% similarity]
tests/commands/0100_compile.test [new file with mode: 0644]
tests/commands/0101_info.test [new file with mode: 0644]
tests/run-tests.php

diff --git a/tests/code/class.php b/tests/code/class.php
new file mode 100644 (file)
index 0000000..84efca9
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+class test {
+       
+       public function testMethod(){}
+       private function testPrivateMethod(){}
+       protected function testProtectedMethod(){}
+}
+?>
similarity index 100%
rename from tests/set.test
rename to tests/commands/0002_set.test
diff --git a/tests/commands/0100_compile.test b/tests/commands/0100_compile.test
new file mode 100644 (file)
index 0000000..9b71e04
--- /dev/null
@@ -0,0 +1,13 @@
+#################################################
+# name: compile
+# purpose: test pre-compilation
+# expect: TEST::CISTRING
+# options: -rr
+#################################################
+# set execution context
+# attempting compilation
+# success
+#################################################
+exec sapi/phpdbg/tests/code/class.php
+compile
+q
diff --git a/tests/commands/0101_info.test b/tests/commands/0101_info.test
new file mode 100644 (file)
index 0000000..efacd37
--- /dev/null
@@ -0,0 +1,17 @@
+#################################################
+# name: info
+# purpose: test info commands
+# expect: TEST::CISTRING
+# options: -rr
+#################################################
+# set execution context
+# attempting compilation
+# success
+# user classes
+# user class test
+# |---- in
+#################################################
+exec sapi/phpdbg/tests/code/class.php
+compile
+info classes
+q
index 397e91a8ae4016a6fbe6e5ea9373e6d88cb2b32c..e3f26c28eb6fbc99b67e5f7272ebb509bc7416a4 100644 (file)
@@ -152,25 +152,31 @@ namespace phpdbg\testing {
                * @param string the path to log
                */
                public function logPathStats($path) {
+                       if (!isset($this->stats[$path])) {
+                               return;
+                       }
+                       
                        $total = array_sum($this->stats[$path]);
                        
-                       @$this->totals[true] += $this->stats[$path][true];
-                       @$this->totals[false] += $this->stats[$path][false];
+                       if ($total) {
+                               @$this->totals[true] += $this->stats[$path][true];
+                               @$this->totals[false] += $this->stats[$path][false];
                        
-                       $stats = @sprintf(
-                               "%d/%d %%%d", 
-                               $this->stats[$path][true],
-                               $this->stats[$path][false],
-                               (100 / $total) * $this->stats[$path][true]);
+                               $stats = @sprintf(
+                                       "%d/%d %%%d", 
+                                       $this->stats[$path][true],
+                                       $this->stats[$path][false],
+                                       (100 / $total) * $this->stats[$path][true]);
                        
-                       printf(
-                               '%s [%s]%s',
-                               str_repeat(
-                                       ' ', $this->config['width'] - strlen($stats)), 
-                               $stats, PHP_EOL);
+                               printf(
+                                       '%s [%s]%s',
+                                       str_repeat(
+                                               ' ', $this->config['width'] - strlen($stats)), 
+                                       $stats, PHP_EOL);
                        
-                       printf("%s%s", str_repeat('-', $this->config['width']+3), PHP_EOL);
-                       printf("%s", PHP_EOL);
+                               printf("%s%s", str_repeat('-', $this->config['width']+3), PHP_EOL);
+                               printf("%s", PHP_EOL);
+                       }
                }
                
                /**