OSDN Git Service

uri_pickup_normalize_pathtofile(): Added
[pukiwiki/pukiwiki_sandbox.git] / spam / SpamPickupTest.php
index 98d034b..005ca3c 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: SpamPickupTest.php,v 1.6 2008/12/30 11:13:49 henoheno Exp $
+// $Id: SpamPickupTest.php,v 1.7 2008/12/31 15:44:14 henoheno Exp $
 // Copyright (C) 2007 heno
 //
 // Design test case for spam.php (called from runner.php)
@@ -368,6 +368,14 @@ EOF;
                $results = uri_pickup_normalize(uri_pickup($test_string));
                $this->assertEquals('sss',            $results[0]['host']);
                $this->assertEquals('foo.html',       $results[0]['file']);
+
+               // uri_pickup_normalize_pathtofile()
+               $test_string = ' http://example.com/path/to/directory-accidentally-not-ended-with-slash ';
+               $results = uri_pickup_normalize_pathtofile(uri_pickup($test_string));
+               $this->assertEquals('/path/to/directory-accidentally-not-ended-with-slash',
+                       $results[0]['pathtofile']);
+               $this->assertEquals(FALSE, isset($results[0]['path']));
+               $this->assertEquals(FALSE, isset($results[0]['file']));
        }
 
        function testFunc_spam_uri_pickup()