test skeleton for status_noauth
authorChristian Weiske <cweiske@cweiske.de>
Tue, 14 Dec 2010 06:47:54 +0000 (07:47 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 14 Dec 2010 06:47:54 +0000 (07:47 +0100)
Wrt3g/HtmlParser.php
tests/status_noauth-connected.htm [moved from tests/Status_NoAuth.htm with 100% similarity]
tests/status_noauth-connected.phpt [new file with mode: 0644]

index 1cd5373ff476c115e6c7cab7a5a046235beca5bf..fe81c586ef1421d25eab8243574bfd0011ac9ca1 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 /**
-* HTML parsing for the linksys router HTML pages
-*
-* PHP version 5
-*
-* @category Tools
-* @package  linksys-wrt3g-tools
-* @author   Christian Weiske <cweiske@cweiske.de>
-* @license  AGPL v3
-* @link     http://cweiske.de/linksys-wrt3g-tools.htm
-*/
+ * HTML parsing for the linksys router HTML pages
+ *
+ * PHP version 5
+ *
+ * @category Tools
+ * @package  linksys-wrt3g-tools
+ * @author   Christian Weiske <cweiske@cweiske.de>
+ * @license  AGPL v3
+ * @link     http://cweiske.de/linksys-wrt3g-tools.htm
+ */
 class Wrt3g_HtmlParser
 {
     protected static $arTranslations = array(
@@ -26,13 +26,13 @@ class Wrt3g_HtmlParser
 
 
     /**
-    * Parses the body of /index_wstatus1.asp and returns extracted values.
-    *
-    * @param string $body HTML document to parse
-    *
-    * @return array Array of key-value pairs, probably with "type", "network" and
-    *               "signal strength"
-    */
+     * Parses the body of /index_wstatus1.asp and returns extracted values.
+     *
+     * @param string $body HTML document to parse
+     *
+     * @return array Array of key-value pairs, probably with "type", "network" and
+     *               "signal strength"
+     */
     public function index_wstatus1($body)
     {
         $doc = new DomDocument();
@@ -84,13 +84,13 @@ class Wrt3g_HtmlParser
 
 
     /**
-    * Parses the body of /index_wstatus2.asp and returns extracted values.
-    *
-    * @param string $body HTML document to parse
-    *
-    * @return array Array with "connection" as key and one of "connecting",
-    *               "connected" or "disconnected" as value.
-    */
+     * Parses the body of /index_wstatus2.asp and returns extracted values.
+     *
+     * @param string $body HTML document to parse
+     *
+     * @return array Array with "connection" as key and one of "connecting",
+     *               "connected" or "disconnected" as value.
+     */
     public function index_wstatus2($body)
     {
         preg_match('/var status2 = "(.+)"/', $body, $arMatches);
@@ -101,4 +101,18 @@ class Wrt3g_HtmlParser
         //Connected
         return array('connection' => strtolower($strStatus));
     }
+
+
+
+    /**
+     * Parses the HTML body of /Status_NoAuth.asp and returns the extracted
+     * values.
+     *
+     * @param string $body HTML document to parse
+     *
+     * @return array FIXME
+     */
+    public function status_noauth($body)
+    {
+    }
 }
\ No newline at end of file
diff --git a/tests/status_noauth-connected.phpt b/tests/status_noauth-connected.phpt
new file mode 100644 (file)
index 0000000..37cb3df
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+test Wrt3g_HtmlParser::status_noauth() when we have a good connection
+--FILE--
+<?php
+chdir(dirname(__FILE__));
+require_once dirname(__FILE__) . '/../Wrt3g/HtmlParser.php';
+$p = new Wrt3g_HtmlParser();
+var_dump(
+    $p->status_noauth(
+        file_get_contents('status_noauth-connected.htm')
+    )
+);
+--EXPECT--