Perforce Chronicle 2012.2/486814
API Documentation
|
Test the url path filter (normalizer). More...
Public Member Functions | |
setUp () | |
Activate url module. | |
testFilter () | |
Test various url path inputs to ensure they are normalized consistently. |
Test the url path filter (normalizer).
Url_Test_UrlPathFilterTest::setUp | ( | ) |
Activate url module.
{ parent::setUp(); P4Cms_Module::fetch('Url')->enable()->load(); }
Url_Test_UrlPathFilterTest::testFilter | ( | ) |
Test various url path inputs to ensure they are normalized consistently.
{ $tests = array( 'test-path' => 'test-path', 'test+path' => 'test+path', 'special-!@$&*()' => 'special-!@$&*()', 'test path' => 'test%20path', 'bad-encode%zz' => 'bad-encode%25zz', 'foobar-#?' => 'foobar-%23%3f', 'biz/bang' => 'biz/bang', 'fizzle%' => 'fizzle%25', '/woozle ' => 'woozle' ); $filter = new Url_Filter_UrlPath; foreach ($tests as $input => $output) { $this->assertSame($output, $filter->filter($output)); } // ensure filter can be run multiple times without double encoding $input = "/path with spaces/"; $expected = "path%20with%20spaces"; $output = $filter->filter($input); $this->assertSame($expected, $output); $this->assertSame($expected, $filter->filter($output)); // null in, null out. $this->assertSame(null, $filter->filter(null)); }