From bb58051f2f1dfd4e8b00ff68a9f6952979ba69a5 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 3 Dec 2009 19:00:44 +0100 Subject: [PATCH] Fix class names, ws. --- .../Routes/test/Horde/Routes/GenerationTest.php | 2 +- .../Routes/test/Horde/Routes/RecognitionTest.php | 292 ++++++++++----------- framework/Routes/test/Horde/Routes/UtilTest.php | 2 +- .../test/Horde/Routes/UtilWithExplicitTest.php | 2 +- 4 files changed, 149 insertions(+), 149 deletions(-) diff --git a/framework/Routes/test/Horde/Routes/GenerationTest.php b/framework/Routes/test/Horde/Routes/GenerationTest.php index 92ba3e75e..75833d26e 100644 --- a/framework/Routes/test/Horde/Routes/GenerationTest.php +++ b/framework/Routes/test/Horde/Routes/GenerationTest.php @@ -15,7 +15,7 @@ /** * @package Horde_Routes */ -class GenerationTest extends PHPUnit_Framework_TestCase +class Horde_Routes_GenerationTest extends PHPUnit_Framework_TestCase { public function testAllStaticNoReqs() diff --git a/framework/Routes/test/Horde/Routes/RecognitionTest.php b/framework/Routes/test/Horde/Routes/RecognitionTest.php index 3eabe5db6..7e23842f8 100644 --- a/framework/Routes/test/Horde/Routes/RecognitionTest.php +++ b/framework/Routes/test/Horde/Routes/RecognitionTest.php @@ -3,7 +3,7 @@ * Horde Routes package * * This package is heavily inspired by the Python "Routes" library - * by Ben Bangert (http://routes.groovie.org). Routes is based + * by Ben Bangert (http://routes.groovie.org). Routes is based * largely on ideas from Ruby on Rails (http://www.rubyonrails.org). * * @author Maintainable Software, LLC. (http://www.maintainable.com) @@ -15,14 +15,14 @@ /** * @package Horde_Routes */ -class RecognitionTest extends PHPUnit_Framework_TestCase +class Horde_Routes_RecognitionTest extends PHPUnit_Framework_TestCase { public function testRegexpCharEscaping() { $m = new Horde_Routes_Mapper(); $m->connect(':controller/:(action).:(id)'); $m->createRegs(array('content')); - + $this->assertNull($m->match('/content/view#2')); $matchdata = array('action' => 'view', 'controller' => 'content', 'id' => '2'); @@ -36,21 +36,21 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('action' => 'view', 'controller' => 'find.all', 'id'=> null); $this->assertEquals($matchdata, $m->match('/find.all/view')); - + $this->assertNull($m->match('/findzall/view')); } - + public function testAllStatic() { $m = new Horde_Routes_Mapper(); $m->connect('hello/world/how/are/you', array('controller' => 'content', 'action' => 'index')); $m->createRegs(array()); - + $this->assertNull($m->match('/x')); $this->assertNull($m->match('/hello/world/how')); $this->assertNull($m->match('/hello/world/how/are')); $this->assertNull($m->match('/hello/world/how/are/you/today')); - + $matchdata = array('controller' => 'content', 'action' =>'index'); $this->assertEquals($matchdata, $m->match('/hello/world/how/are/you')); } @@ -59,19 +59,19 @@ class RecognitionTest extends PHPUnit_Framework_TestCase { // php version does not handing decoding } - + public function testDisablingUnicode() { // php version does not handing decoding } - + public function testBasicDynamic() { foreach(array('hi/:name', 'hi/:(name)') as $path) { $m = new Horde_Routes_Mapper(); $m->connect($path, array('controller' => 'content')); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/hi')); @@ -89,13 +89,13 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m = new Horde_Routes_Mapper(); $m->connect($path); $m->createRegs(); - + $this->assertNull($m->match('/')); $this->assertNull($m->match('/hi')); $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/shop/walmart/hi')); - + $matchdata = array('name' => 'fred', 'action' => 'index', 'controller' => 'content'); $this->assertEquals($matchdata, $m->match('/fred/hi')); @@ -110,7 +110,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m->connect('article/:small_page', array('small_page' => false)); $m->connect(':(controller)/:(action)/:(id)'); $m->createRegs(array('article', 'blog')); - + $matchdata = array('controller' => 'blog', 'action' => 'view', 'id' => '0'); $this->assertEquals($matchdata, $m->match('/blog/view/0')); @@ -124,7 +124,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m = new Horde_Routes_Mapper(); $m->connect($path, array('controller' => 'content')); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/hi/dude/what')); @@ -134,7 +134,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'content', 'action' => 'index'); $this->assertEquals($matchdata, $m->match('/hi/index')); - + $matchdata = array('controller' => 'content', 'action' => 'dude'); $this->assertEquals($matchdata, $m->match('/hi/dude')); } @@ -165,10 +165,10 @@ class RecognitionTest extends PHPUnit_Framework_TestCase { foreach (array(':name/hi', ':(name)/hi') as $path) { $m = new Horde_Routes_Mapper(); - $m->connect($path, array('controller' => 'content', + $m->connect($path, array('controller' => 'content', 'requirements' => array('name' => 'index'))); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/hi')); @@ -192,12 +192,12 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/hi')); $this->assertNull($m->match('/hi/dude/what')); - + $matchdata = array('controller' => 'content', 'name' => 'index', 'action' => 'index'); $this->assertEquals($matchdata, $m->match('/hi/index')); $this->assertEquals($matchdata, $m->match('/hi/index')); - + $this->assertNull($m->match('/dude/hi')); } } @@ -209,7 +209,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m->connect($path, array('controller' => 'content', 'requirements' => array('name' => '[a-z]+'))); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/hi')); @@ -234,14 +234,14 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m->connect($path, array('controller' => 'content', 'requirements' => array('action' => '[a-z]+'))); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/hi/FOXY')); $this->assertNull($m->match('/hi/138708jkhdf')); $this->assertNull($m->match('/hi/dkjfl8792343dfsf')); $this->assertNull($m->match('/hi/dude/what/')); - + $matchdata = array('controller' => 'content', 'action' => 'index'); $this->assertEquals($matchdata, $m->match('/hi')); $this->assertEquals($matchdata, $m->match('/hi/index')); @@ -257,7 +257,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m = new Horde_Routes_Mapper(); $m->connect($path); $m->createRegs(); - + $this->assertNull($m->match('/')); $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); @@ -284,14 +284,14 @@ class RecognitionTest extends PHPUnit_Framework_TestCase public function testMultiroute() { $m = new Horde_Routes_Mapper(); - $m->connect('archive/:year/:month/:day', array('controller' => 'blog', 'action' => 'view', + $m->connect('archive/:year/:month/:day', array('controller' => 'blog', 'action' => 'view', 'month' => null, 'day' => null, 'requirements' => array('month' => '\d{1,2}', 'day' => '\d{1,2}'))); $m->connect('viewpost/:id', array('controller' => 'post', 'action' => 'view')); $m->connect(':controller/:action/:id'); $m->createRegs(array('post','blog','admin/user')); - + $this->assertNull($m->match('/')); $this->assertNull($m->match('/archive')); $this->assertNull($m->match('/archive/2004/ab')); @@ -303,7 +303,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase 'month' => null, 'day' => null, 'year' => '2004'); $this->assertEquals($matchdata, $m->match('/archive/2004')); - $matchdata = array('controller' => 'blog', 'action' => 'view', + $matchdata = array('controller' => 'blog', 'action' => 'view', 'month' => '4', 'day' => null, 'year' =>'2004'); $this->assertEquals($matchdata, $m->match('/archive/2004/4')); } @@ -311,14 +311,14 @@ class RecognitionTest extends PHPUnit_Framework_TestCase public function testMultirouteWithSplits() { $m = new Horde_Routes_Mapper(); - $m->connect('archive/:(year)/:(month)/:(day)', array('controller' => 'blog', 'action' => 'view', + $m->connect('archive/:(year)/:(month)/:(day)', array('controller' => 'blog', 'action' => 'view', 'month' => null, 'day' => null, 'requirements' => array('month' => '\d{1,2}', 'day' => '\d{1,2}'))); $m->connect('viewpost/:(id)', array('controller' => 'post', 'action' => 'view')); $m->connect(':(controller)/:(action)/:(id)'); $m->createRegs(array('post','blog','admin/user')); - + $this->assertNull($m->match('/')); $this->assertNull($m->match('/archive')); $this->assertNull($m->match('/archive/2004/ab')); @@ -330,21 +330,21 @@ class RecognitionTest extends PHPUnit_Framework_TestCase 'month' => null, 'day' => null, 'year' => '2004'); $this->assertEquals($matchdata, $m->match('/archive/2004')); - $matchdata = array('controller' => 'blog', 'action' => 'view', + $matchdata = array('controller' => 'blog', 'action' => 'view', 'month' => '4', 'day' => null, 'year' => '2004'); - $this->assertEquals($matchdata, $m->match('/archive/2004/4')); + $this->assertEquals($matchdata, $m->match('/archive/2004/4')); } - + public function testDynamicWithRegexpDefaultsAndGaps() { $m = new Horde_Routes_Mapper(); - $m->connect('archive/:year/:month/:day', array('controller' => 'blog', 'action' => 'view', + $m->connect('archive/:year/:month/:day', array('controller' => 'blog', 'action' => 'view', 'month' => null, 'day' => null, 'requirements' => array('month' => '\d{1,2}'))); $m->connect('view/:id/:controller', array('controller' => 'blog', 'action' => 'view', 'id' => 2, 'requirements' => array('id' => '\d{1,2}'))); - $m->createRegs(array('post','blog','admin/user')); - + $m->createRegs(array('post','blog','admin/user')); + $this->assertNull($m->match('/')); $this->assertNull($m->match('/archive')); $this->assertNull($m->match('/archive/2004/haha')); @@ -352,8 +352,8 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'blog', 'action' => 'view', 'id' => '2'); $this->assertEquals($matchdata, $m->match('/view')); - - $matchdata = array('controller' => 'blog', 'action' => 'view', + + $matchdata = array('controller' => 'blog', 'action' => 'view', 'month' => null, 'day' => null, 'year' => '2004'); $this->assertEquals($matchdata, $m->match('/archive/2004')); } @@ -361,13 +361,13 @@ class RecognitionTest extends PHPUnit_Framework_TestCase public function testDynamicWithRegexpDefaultsAndGapsAndSplits() { $m = new Horde_Routes_Mapper(); - $m->connect('archive/:(year)/:(month)/:(day)', array('controller' => 'blog', 'action' => 'view', + $m->connect('archive/:(year)/:(month)/:(day)', array('controller' => 'blog', 'action' => 'view', 'month' => null, 'day' => null, 'requirements' => array('month' => '\d{1,2}'))); $m->connect('view/:(id)/:(controller)', array('controller' => 'blog', 'action' => 'view', 'id' => 2, 'requirements' => array('id' => '\d{1,2}'))); - $m->createRegs(array('post','blog','admin/user')); - + $m->createRegs(array('post','blog','admin/user')); + $this->assertNull($m->match('/')); $this->assertNull($m->match('/archive')); $this->assertNull($m->match('/archive/2004/haha')); @@ -375,19 +375,19 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'blog', 'action' => 'view', 'id' => '2'); $this->assertEquals($matchdata, $m->match('/view')); - - $matchdata = array('controller' => 'blog', 'action' => 'view', + + $matchdata = array('controller' => 'blog', 'action' => 'view', 'month' => null, 'day' => null, 'year' => '2004'); - $this->assertEquals($matchdata, $m->match('/archive/2004')); + $this->assertEquals($matchdata, $m->match('/archive/2004')); } - + public function testDynamicWithRegexpGapsControllers() { foreach(array('view/:id/:controller', 'view/:(id)/:(controller)') as $path) { $m = new Horde_Routes_Mapper(); $m->connect($path, array('id' => 2, 'action' => 'view', 'requirements' => array('id' => '\d{1,2}'))); $m->createRegs(array('post', 'blog', 'admin/user')); - + $this->assertNull($m->match('/')); $this->assertNull($m->match('/view')); $this->assertNull($m->match('/view/blog')); @@ -398,7 +398,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $this->assertEquals($matchdata, $m->match('/view/2/blog')); } } - + public function testDynamicWithTrailingStrings() { foreach (array('view/:id/:controller/super', 'view/:(id)/:(controller)/super') as $path) { @@ -434,7 +434,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'blog', 'action' => 'index', 'over' => 'near'); $this->assertEquals($matchdata, $m->match('/somewhere/near/rainbow')); - + $matchdata = array('controller' => 'post', 'action' => 'index', 'over' => 'tomorrow'); $this->assertEquals($matchdata, $m->match('/somewhere/tomorrow')); } @@ -445,7 +445,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m = new Horde_Routes_Mapper(); $m->connect($path, array('controller' => 'blog')); $m->createRegs(array('blog')); - + $this->assertNull($m->match('/')); $this->assertNull($m->match('/archives')); $this->assertNull($m->match('/archives/introduction')); @@ -455,7 +455,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'blog', 'action' => 'view', 'article' => 'introduction'); $this->assertEquals($matchdata, $m->match('/archives/view/introduction')); - + $matchdata = array('controller' => 'blog', 'action' => 'edit', 'article' => 'recipes'); $this->assertEquals($matchdata, $m->match('/archives/edit/recipes')); } @@ -467,19 +467,19 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m = new Horde_Routes_Mapper(); $m->connect($path, array('controller' => 'content', 'action' => 'download')); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/hi')); - - $matchdata = array('controller' => 'content', 'action' => 'download', + + $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => 'books/learning_python.pdf'); $this->assertEquals($matchdata, $m->match('/hi/books/learning_python.pdf')); - + $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => 'dude'); $this->assertEquals($matchdata, $m->match('/hi/dude')); - + $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => 'dude/what'); $this->assertEquals($matchdata, $m->match('/hi/dude/what')); @@ -492,7 +492,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m = new Horde_Routes_Mapper(); $m->connect($path); $m->createRegs(array('content', 'admin/user')); - + $this->assertNull($m->match('/')); $this->assertNull($m->match('/blog')); $this->assertNull($m->match('/content')); @@ -516,9 +516,9 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m = new Horde_Routes_Mapper(); $m->connect($path, array('controller' => 'content', 'action' => 'view', 'url' => null)); $m->createRegs(array('content', 'admin/user')); - + $this->assertNull($m->match('/goober/view/here')); - + $matchdata = array('controller' => 'content', 'action' => 'view', 'url' => null); $this->assertEquals($matchdata, $m->match('/content')); $this->assertEquals($matchdata, $m->match('/content/')); @@ -532,39 +532,39 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $this->assertEquals($matchdata, $m->match('/admin/user/view')); } } - + public function testPathWithDynamicAndDefaultBackwards() { foreach (array('*file/login', '*(file)/login') as $path) { $m = new Horde_Routes_Mapper(); $m->connect($path, array('controller' => 'content', 'action' => 'download', 'file' => null)); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => ''); $this->assertEquals($matchdata, $m->match('//login')); - + $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => 'books/learning_python.pdf'); $this->assertEquals($matchdata, $m->match('/books/learning_python.pdf/login')); - + $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => 'dude'); $this->assertEquals($matchdata, $m->match('/dude/login')); - + $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => 'dude/what'); $this->assertEquals($matchdata, $m->match('/dude/what/login')); } } - + public function testPathBackwards() { foreach (array('*file/login', '*(file)/login') as $path) { $m = new Horde_Routes_Mapper(); $m->connect($path, array('controller' => 'content', 'action' => 'download')); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/login')); @@ -572,89 +572,89 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => 'books/learning_python.pdf'); $this->assertEquals($matchdata, $m->match('/books/learning_python.pdf/login')); - + $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => 'dude'); $this->assertEquals($matchdata, $m->match('/dude/login')); - + $matchdata = array('controller' => 'content', 'action' => 'download', 'file' => 'dude/what'); $this->assertEquals($matchdata, $m->match('/dude/what/login')); } } - + public function testPathBackwardsWithController() { $m = new Horde_Routes_Mapper(); $m->connect('*url/login', array('controller' => 'content', 'action' => 'check_access')); $m->connect('*url/:controller', array('action' => 'view')); $m->createRegs(array('content', 'admin/user')); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/login')); - + $matchdata = array('controller' => 'content', 'action' => 'check_access', 'url' => 'books/learning_python.pdf'); $this->assertEquals($matchdata, $m->match('/books/learning_python.pdf/login')); - + $matchdata = array('controller' => 'content', 'action' => 'check_access', 'url' => 'dude'); $this->assertEquals($matchdata, $m->match('/dude/login')); - + $matchdata = array('controller' => 'content', 'action' => 'check_access', 'url' => 'dude/what'); $this->assertEquals($matchdata, $m->match('/dude/what/login')); $this->assertNull($m->match('/admin/user')); - + $matchdata = array('controller' => 'admin/user', 'action' => 'view', 'url' => 'books/learning_python.pdf'); $this->assertEquals($matchdata, $m->match('/books/learning_python.pdf/admin/user')); - + $matchdata = array('controller' => 'admin/user', 'action' => 'view', 'url' => 'dude'); $this->assertEquals($matchdata, $m->match('/dude/admin/user')); - + $matchdata = array('controller' => 'admin/user', 'action' => 'view', 'url' => 'dude/what'); $this->assertEquals($matchdata, $m->match('/dude/what/admin/user')); } - + public function testPathBackwardsWithControllerAndSplits() { $m = new Horde_Routes_Mapper(); $m->connect('*(url)/login', array('controller' => 'content', 'action' => 'check_access')); $m->connect('*(url)/:(controller)', array('action' => 'view')); $m->createRegs(array('content', 'admin/user')); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/login')); - + $matchdata = array('controller' => 'content', 'action' => 'check_access', 'url' => 'books/learning_python.pdf'); $this->assertEquals($matchdata, $m->match('/books/learning_python.pdf/login')); - + $matchdata = array('controller' => 'content', 'action' => 'check_access', 'url' => 'dude'); $this->assertEquals($matchdata, $m->match('/dude/login')); - + $matchdata = array('controller' => 'content', 'action' => 'check_access', 'url' => 'dude/what'); $this->assertEquals($matchdata, $m->match('/dude/what/login')); $this->assertNull($m->match('/admin/user')); - + $matchdata = array('controller' => 'admin/user', 'action' => 'view', 'url' => 'books/learning_python.pdf'); $this->assertEquals($matchdata, $m->match('/books/learning_python.pdf/admin/user')); - + $matchdata = array('controller' => 'admin/user', 'action' => 'view', 'url' => 'dude'); $this->assertEquals($matchdata, $m->match('/dude/admin/user')); - + $matchdata = array('controller' => 'admin/user', 'action' => 'view', 'url' => 'dude/what'); - $this->assertEquals($matchdata, $m->match('/dude/what/admin/user')); + $this->assertEquals($matchdata, $m->match('/dude/what/admin/user')); } - + public function testController() { $m = new Horde_Routes_Mapper(); $m->connect('hi/:controller', array('action' => 'hi')); $m->createRegs(array('content', 'admin/user')); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/hi/13870948')); @@ -664,35 +664,35 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'content', 'action' => 'hi'); $this->assertEquals($matchdata, $m->match('/hi/content')); - + $matchdata = array('controller' => 'admin/user', 'action' => 'hi'); $this->assertEquals($matchdata, $m->match('/hi/admin/user')); } - + public function testStandardRoute() { $m = new Horde_Routes_Mapper(); $m->connect(':controller/:action/:id'); $m->createRegs(array('content', 'admin/user')); - + $matchdata = array('controller' => 'content', 'action' => 'index', 'id' => null); $this->assertEquals($matchdata, $m->match('/content')); - + $matchdata = array('controller' => 'content', 'action' => 'list', 'id' => null); $this->assertEquals($matchdata, $m->match('/content/list')); - + $matchdata = array('controller' => 'content', 'action' => 'show', 'id' => '10'); $this->assertEquals($matchdata, $m->match('/content/show/10')); $matchdata = array('controller' => 'admin/user', 'action' => 'index', 'id' => null); $this->assertEquals($matchdata, $m->match('/admin/user')); - + $matchdata = array('controller' => 'admin/user', 'action' => 'list', 'id' => null); $this->assertEquals($matchdata, $m->match('/admin/user/list')); - + $matchdata = array('controller' => 'admin/user', 'action' => 'show', 'id' => 'bbangert'); $this->assertEquals($matchdata, $m->match('/admin/user/show/bbangert')); - + $this->assertNull($m->match('/content/show/10/20')); $this->assertNull($m->match('/food')); } @@ -705,18 +705,18 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'content', 'action' => 'index', 'id' => 'None'); $this->assertEquals($matchdata, $m->match('/content/index/None.py')); - + $matchdata = array('controller' =>'content', 'action' => 'list', 'id' => 'None'); - $this->assertEquals($matchdata, $m->match('/content/list/None.py')); + $this->assertEquals($matchdata, $m->match('/content/list/None.py')); $matchdata = array('controller' => 'content', 'action' => 'show', 'id' => '10'); - $this->assertEquals($matchdata, $m->match('/content/show/10.py')); + $this->assertEquals($matchdata, $m->match('/content/show/10.py')); } public function testStandardRouteWithGapsAndDomains() { $m = new Horde_Routes_Mapper(); - $m->connect('manage/:domain.:ext', array('controller' => 'admin/user', 'action' => 'view', + $m->connect('manage/:domain.:ext', array('controller' => 'admin/user', 'action' => 'view', 'ext' => 'html')); $m->connect(':controller/:action/:id'); $m->createRegs(array('content', 'admin/user')); @@ -729,22 +729,22 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'content', 'action' => 'show', 'id' => '10.py'); $this->assertEquals($matchdata, $m->match('/content/show/10.py')); - + $matchdata = array('controller' => 'content', 'action' => 'show.all', 'id' => '10.py'); $this->assertEquals($matchdata, $m->match('/content/show.all/10.py')); - + $matchdata = array('controller' => 'content', 'action' => 'show', 'id' => 'www.groovie.org'); $this->assertEquals($matchdata, $m->match('/content/show/www.groovie.org')); - $matchdata = array('controller' => 'admin/user', 'action' => 'view', + $matchdata = array('controller' => 'admin/user', 'action' => 'view', 'ext' => 'html', 'domain' => 'groovie'); $this->assertEquals($matchdata, $m->match('/manage/groovie')); - - $matchdata = array('controller' => 'admin/user', 'action' => 'view', + + $matchdata = array('controller' => 'admin/user', 'action' => 'view', 'ext' => 'xml', 'domain' => 'groovie'); - $this->assertEquals($matchdata, $m->match('/manage/groovie.xml')); + $this->assertEquals($matchdata, $m->match('/manage/groovie.xml')); } - + public function testStandardWithDomains() { $m = new Horde_Routes_Mapper(); @@ -765,7 +765,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $this->assertNull($m->match('/hello/world')); $this->assertNull($m->match('/hello/world/how/are')); $this->assertNull($m->match('/hello/world/how/are/you/today')); - + $matchdata = array('controller' => 'content', 'action' => 'index'); $this->assertEquals($matchdata, $m->match('/')); } @@ -791,10 +791,10 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'admin/comments', 'action' => 'view', 'id' => null); $this->assertEquals($matchdata, $m->match('/blog/admin/comments/view')); - + $matchdata = array('controller' => 'archive', 'action' => 'index', 'id' => null); $this->assertEquals($matchdata, $m->match('/blog/archive')); - + $matchdata = array('controller' => 'archive', 'action' => 'view', 'id' => '4'); $this->assertEquals($matchdata, $m->match('/blog/archive/view/4')); } @@ -807,12 +807,12 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m->connect('home/:action', array('controller' => 'archive')); $m->connect('', array('controller' => 'content')); $m->createRegs(array('content', 'archive', 'admin/comments')); - + $this->assertNull($m->match('/x')); $this->assertNull($m->match('/admin/comments')); $this->assertNull($m->match('/content/view')); $this->assertNull($m->match('/archive/view/4')); - + $matchdata = array('controller' => 'content', 'action' => 'index'); $this->assertEquals($matchdata, $m->match('/blog/')); @@ -837,7 +837,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m = new Horde_Routes_Mapper(); $m->connect('hi/:(action).html', array('controller' => 'content')); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/boo/blah')); $this->assertNull($m->match('/hi/dude/what')); @@ -845,7 +845,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'content', 'action' => 'index'); $this->assertEquals($matchdata, $m->match('/hi/index.html')); - + $matchdata = array('controller' => 'content', 'action' => 'dude'); $this->assertEquals($matchdata, $m->match('/hi/dude.html')); } @@ -853,9 +853,9 @@ class RecognitionTest extends PHPUnit_Framework_TestCase public function testSplitsWithDashes() { $m = new Horde_Routes_Mapper(); - $m->connect('archives/:(year)-:(month)-:(day).html', + $m->connect('archives/:(year)-:(month)-:(day).html', array('controller' => 'archives', 'action' => 'view')); - $m->createRegs(); + $m->createRegs(); $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/archives')); @@ -863,38 +863,38 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'archives', 'action' => 'view', 'year' => '2004', 'month' => '12', 'day' => '4'); $this->assertEquals($matchdata, $m->match('/archives/2004-12-4.html')); - + $matchdata = array('controller' => 'archives', 'action' => 'view', 'year' => '04', 'month' => '10', 'day' => '4'); $this->assertEquals($matchdata, $m->match('/archives/04-10-4.html')); - + $matchdata = array('controller' => 'archives', 'action' => 'view', 'year' => '04', 'month' => '1', 'day' => '1'); $this->assertEquals($matchdata, $m->match('/archives/04-1-1.html')); } - + public function testSplitsPackedWithRegexps() { $m = new Horde_Routes_Mapper(); $m->connect('archives/:(year):(month):(day).html', array('controller' => 'archives', 'action' => 'view', - 'requirements' => array('year' => '\d{4}', 'month' => '\d{2}', + 'requirements' => array('year' => '\d{4}', 'month' => '\d{2}', 'day' => '\d{2}'))); $m->createRegs(); - + $this->assertNull($m->match('/boo')); $this->assertNull($m->match('/archives')); $this->assertNull($m->match('/archives/2004020.html')); - $this->assertNull($m->match('/archives/200502.html')); + $this->assertNull($m->match('/archives/200502.html')); $matchdata = array('controller' => 'archives', 'action' => 'view', 'year' => '2004', 'month' => '12', 'day' => '04'); $this->assertEquals($matchdata, $m->match('/archives/20041204.html')); - + $matchdata = array('controller' => 'archives', 'action' => 'view', 'year' => '2005', 'month' => '10', 'day' => '04'); $this->assertEquals($matchdata, $m->match('/archives/20051004.html')); - + $matchdata = array('controller' => 'archives', 'action' => 'view', 'year' => '2006', 'month' => '01', 'day' => '01'); $this->assertEquals($matchdata, $m->match('/archives/20060101.html')); @@ -908,7 +908,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $this->assertNull($m->match('/something')); $this->assertNull($m->match('/something/is-')); - $matchdata = array('controller' => 'content', 'action' => 'view', + $matchdata = array('controller' => 'content', 'action' => 'view', 'day' => '3', 'name' => 'group'); $this->assertEquals($matchdata, $m->match('/group/view-3')); @@ -929,12 +929,12 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $matchdata = array('controller' => 'content', 'action' => 'view', 'id' => '3', 'name' => 'group'); $this->assertEquals($matchdata, $m->match('/group/view-3')); - + $matchdata = array('controller' => 'content', 'action' => 'view', 'id' => null, 'name' => 'group'); $this->assertEquals($matchdata, $m->match('/group/view-')); } - + public function testNoRegMake() { $m = new Horde_Routes_Mapper(); @@ -947,22 +947,22 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $this->assertRegExp('/must generate the regular expressions/i', $e->getMessage()); } } - + public function testRoutematch() { $m = new Horde_Routes_Mapper(); $m->connect(':controller/:action/:id'); $m->createRegs(array('content')); $route = $m->matchList[0]; - + list($resultdict, $resultObj) = $m->routematch('/content'); - + $this->assertEquals(array('controller' => 'content', 'action' => 'index', 'id' => null), $resultdict); $this->assertSame($route, $resultObj); $this->assertNull($m->routematch('/nowhere')); } - + public function testRoutematchDebug() { $m = new Horde_Routes_Mapper(); @@ -970,11 +970,11 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $m->debug = true; $m->createRegs(array('content')); $route = $m->matchList[0]; - + list($resultdict, $resultObj, $debug) = $m->routematch('/content'); $this->assertEquals(array('controller' => 'content', 'action' => 'index', 'id' => null), - $resultdict); + $resultdict); $this->assertSame($route, $resultObj); list($resultdict, $resultObj, $debug) = $m->routematch('/nowhere'); @@ -982,7 +982,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $this->assertNull($resultObj); $this->assertEquals(1, count($debug)); } - + public function testMatchDebug() { $m = new Horde_Routes_Mapper(); @@ -995,9 +995,9 @@ class RecognitionTest extends PHPUnit_Framework_TestCase list($resultdict, $resultObj, $debug) = $m->match('/content'); $this->assertEquals(array('controller' => 'content', 'action' => 'index', 'id' => null), $resultdict); - + $this->assertSame($route, $resultObj); - + list($resultdict, $resultObj, $debug) = $m->match('/nowhere'); $this->assertNull($resultdict); $this->assertNull($resultObj); @@ -1030,16 +1030,16 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $path = '/messages.xml'; $m->environ = array('REQUEST_METHOD' => 'GET'); - $this->assertEquals(array('controller' => 'messages', 'action' => 'index', + $this->assertEquals(array('controller' => 'messages', 'action' => 'index', 'format' => 'xml'), $m->match($path)); $m->environ = array('REQUEST_METHOD' => 'POST'); - $this->assertEquals(array('controller' => 'messages', 'action' => 'create', + $this->assertEquals(array('controller' => 'messages', 'action' => 'create', 'format' => 'xml'), - $m->match($path)); + $m->match($path)); } - + public function testResourceMember() { $m = new Horde_Routes_Mapper(); @@ -1049,24 +1049,24 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $path = '/messages/42'; $m->environ = array('REQUEST_METHOD' => 'GET'); - $this->assertEquals(array('controller' => 'messages', 'action' => 'show', + $this->assertEquals(array('controller' => 'messages', 'action' => 'show', 'id' => 42), $m->match($path)); $m->environ = array('REQUEST_METHOD' => 'POST'); $this->assertNull($m->match($path)); - + $m->environ = array('REQUEST_METHOD' => 'PUT'); - $this->assertEquals(array('controller' => 'messages', 'action' => 'update', + $this->assertEquals(array('controller' => 'messages', 'action' => 'update', 'id' => 42), - $m->match($path)); + $m->match($path)); $m->environ = array('REQUEST_METHOD' => 'DELETE'); - $this->assertEquals(array('controller' => 'messages', 'action' => 'delete', + $this->assertEquals(array('controller' => 'messages', 'action' => 'delete', 'id' => 42), $m->match($path)); } - + public function testFormattedResourceMember() { $m = new Horde_Routes_Mapper(); @@ -1076,7 +1076,7 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $path = '/messages/42.xml'; $m->environ = array('REQUEST_METHOD' => 'GET'); - $this->assertEquals(array('controller' => 'messages', 'action' => 'show', + $this->assertEquals(array('controller' => 'messages', 'action' => 'show', 'id' => 42, 'format' => 'xml'), $m->match($path)); @@ -1084,12 +1084,12 @@ class RecognitionTest extends PHPUnit_Framework_TestCase $this->assertNull($m->match($path)); $m->environ = array('REQUEST_METHOD' => 'PUT'); - $this->assertEquals(array('controller' => 'messages', 'action' => 'update', + $this->assertEquals(array('controller' => 'messages', 'action' => 'update', 'id' => 42, 'format' => 'xml'), - $m->match($path)); + $m->match($path)); $m->environ = array('REQUEST_METHOD' => 'DELETE'); - $this->assertEquals(array('controller' => 'messages', 'action' => 'delete', + $this->assertEquals(array('controller' => 'messages', 'action' => 'delete', 'id' => 42, 'format' => 'xml'), $m->match($path)); } diff --git a/framework/Routes/test/Horde/Routes/UtilTest.php b/framework/Routes/test/Horde/Routes/UtilTest.php index 5e5f85d19..3fdc6c5c3 100644 --- a/framework/Routes/test/Horde/Routes/UtilTest.php +++ b/framework/Routes/test/Horde/Routes/UtilTest.php @@ -17,7 +17,7 @@ require_once dirname(__FILE__) . '/TestHelper.php'; /** * @package Horde_Routes */ -class UtilTest extends PHPUnit_Framework_TestCase +class Horde_Routes_UtilTest extends PHPUnit_Framework_TestCase { public function setUp() diff --git a/framework/Routes/test/Horde/Routes/UtilWithExplicitTest.php b/framework/Routes/test/Horde/Routes/UtilWithExplicitTest.php index 4dfc4afd6..219d05e67 100644 --- a/framework/Routes/test/Horde/Routes/UtilWithExplicitTest.php +++ b/framework/Routes/test/Horde/Routes/UtilWithExplicitTest.php @@ -17,7 +17,7 @@ require_once dirname(__FILE__) . '/TestHelper.php'; /** * @package Horde_Routes */ -class UtilWithExplicitTest extends PHPUnit_Framework_TestCase { +class Horde_Routes_UtilWithExplicitTest extends PHPUnit_Framework_TestCase { public function setUp() { -- 2.11.0