-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added addConnect(), addPurge() and addTrace() to Router Group (#14001)
* Removed unused variable. * Added addConnect(), addPurge() and addTrace() to Router Group. * Added tests for Mvc\Router\Group.
- Loading branch information
1 parent
85a60f2
commit 23e92d3
Showing
12 changed files
with
395 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,23 +13,64 @@ | |
namespace Phalcon\Test\Integration\Mvc\Router\Group; | ||
|
||
use IntegrationTester; | ||
use Phalcon\Mvc\Router; | ||
use Phalcon\Mvc\Router\Group; | ||
use Phalcon\Test\Fixtures\Traits\RouterTrait; | ||
|
||
/** | ||
* Class AddDeleteCest | ||
*/ | ||
class AddDeleteCest | ||
{ | ||
use RouterTrait; | ||
|
||
/** | ||
* Tests Phalcon\Mvc\Router\Group :: addDelete() | ||
* | ||
* @param IntegrationTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2018-11-13 | ||
* @author Sid Roberts <[email protected]> | ||
* @since 2019-04-17 | ||
*/ | ||
public function mvcRouterGroupAddDelete(IntegrationTester $I) | ||
{ | ||
$I->wantToTest('Mvc\Router\Group - addDelete()'); | ||
$I->skipTest('Need implementation'); | ||
|
||
$router = $this->getRouter(false); | ||
|
||
$group = new Group(); | ||
|
||
$group->addDelete( | ||
'/docs/index', | ||
[ | ||
'controller' => 'documentation6', | ||
'action' => 'index', | ||
] | ||
); | ||
|
||
$router->mount($group); | ||
|
||
|
||
|
||
$_SERVER['REQUEST_METHOD'] = 'DELETE'; | ||
|
||
$router->handle('/docs/index'); | ||
|
||
|
||
|
||
$I->assertEquals( | ||
'documentation6', | ||
$router->getControllerName() | ||
); | ||
|
||
$I->assertEquals( | ||
'index', | ||
$router->getActionName() | ||
); | ||
|
||
$I->assertEquals( | ||
[], | ||
$router->getParams() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,23 +13,64 @@ | |
namespace Phalcon\Test\Integration\Mvc\Router\Group; | ||
|
||
use IntegrationTester; | ||
use Phalcon\Mvc\Router; | ||
use Phalcon\Mvc\Router\Group; | ||
use Phalcon\Test\Fixtures\Traits\RouterTrait; | ||
|
||
/** | ||
* Class AddGetCest | ||
*/ | ||
class AddGetCest | ||
{ | ||
use RouterTrait; | ||
|
||
/** | ||
* Tests Phalcon\Mvc\Router\Group :: addGet() | ||
* | ||
* @param IntegrationTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2018-11-13 | ||
* @author Sid Roberts <[email protected]> | ||
* @since 2019-04-17 | ||
*/ | ||
public function mvcRouterGroupAddGet(IntegrationTester $I) | ||
{ | ||
$I->wantToTest('Mvc\Router\Group - addGet()'); | ||
$I->skipTest('Need implementation'); | ||
$I->wantToTest('Mvc\Router - addGet()'); | ||
|
||
$router = $this->getRouter(false); | ||
|
||
$group = new Group(); | ||
|
||
$group->addGet( | ||
'/docs/index', | ||
[ | ||
'controller' => 'documentation4', | ||
'action' => 'index', | ||
] | ||
); | ||
|
||
$router->mount($group); | ||
|
||
|
||
|
||
$_SERVER['REQUEST_METHOD'] = 'GET'; | ||
|
||
$router->handle('/docs/index'); | ||
|
||
|
||
|
||
$I->assertEquals( | ||
'documentation4', | ||
$router->getControllerName() | ||
); | ||
|
||
$I->assertEquals( | ||
'index', | ||
$router->getActionName() | ||
); | ||
|
||
$I->assertEquals( | ||
[], | ||
$router->getParams() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,23 +13,64 @@ | |
namespace Phalcon\Test\Integration\Mvc\Router\Group; | ||
|
||
use IntegrationTester; | ||
use Phalcon\Mvc\Router; | ||
use Phalcon\Mvc\Router\Group; | ||
use Phalcon\Test\Fixtures\Traits\RouterTrait; | ||
|
||
/** | ||
* Class AddHeadCest | ||
*/ | ||
class AddHeadCest | ||
{ | ||
use RouterTrait; | ||
|
||
/** | ||
* Tests Phalcon\Mvc\Router\Group :: addHead() | ||
* | ||
* @param IntegrationTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2018-11-13 | ||
* @author Sid Roberts <[email protected]> | ||
* @since 2019-04-17 | ||
*/ | ||
public function mvcRouterGroupAddHead(IntegrationTester $I) | ||
{ | ||
$I->wantToTest('Mvc\Router\Group - addHead()'); | ||
$I->skipTest('Need implementation'); | ||
$I->wantToTest('Mvc\Router - addHead()'); | ||
|
||
$router = $this->getRouter(false); | ||
|
||
$group = new Group(); | ||
|
||
$group->addHead( | ||
'/docs/index', | ||
[ | ||
'controller' => 'documentation8', | ||
'action' => 'index', | ||
] | ||
); | ||
|
||
$router->mount($group); | ||
|
||
|
||
|
||
$_SERVER['REQUEST_METHOD'] = 'HEAD'; | ||
|
||
$router->handle('/docs/index'); | ||
|
||
|
||
|
||
$I->assertEquals( | ||
'documentation8', | ||
$router->getControllerName() | ||
); | ||
|
||
$I->assertEquals( | ||
'index', | ||
$router->getActionName() | ||
); | ||
|
||
$I->assertEquals( | ||
[], | ||
$router->getParams() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,23 +13,64 @@ | |
namespace Phalcon\Test\Integration\Mvc\Router\Group; | ||
|
||
use IntegrationTester; | ||
use Phalcon\Mvc\Router; | ||
use Phalcon\Mvc\Router\Group; | ||
use Phalcon\Test\Fixtures\Traits\RouterTrait; | ||
|
||
/** | ||
* Class AddOptionsCest | ||
*/ | ||
class AddOptionsCest | ||
{ | ||
use RouterTrait; | ||
|
||
/** | ||
* Tests Phalcon\Mvc\Router\Group :: addOptions() | ||
* | ||
* @param IntegrationTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2018-11-13 | ||
* @author Sid Roberts <[email protected]> | ||
* @since 2019-04-17 | ||
*/ | ||
public function mvcRouterGroupAddOptions(IntegrationTester $I) | ||
{ | ||
$I->wantToTest('Mvc\Router\Group - addOptions()'); | ||
$I->skipTest('Need implementation'); | ||
$I->wantToTest('Mvc\Router - addOptions()'); | ||
|
||
$router = $this->getRouter(false); | ||
|
||
$group = new Group(); | ||
|
||
$group->addOptions( | ||
'/docs/index', | ||
[ | ||
'controller' => 'documentation7', | ||
'action' => 'index', | ||
] | ||
); | ||
|
||
$router->mount($group); | ||
|
||
|
||
|
||
$_SERVER['REQUEST_METHOD'] = 'OPTIONS'; | ||
|
||
$router->handle('/docs/index'); | ||
|
||
|
||
|
||
$I->assertEquals( | ||
'documentation7', | ||
$router->getControllerName() | ||
); | ||
|
||
$I->assertEquals( | ||
'index', | ||
$router->getActionName() | ||
); | ||
|
||
$I->assertEquals( | ||
[], | ||
$router->getParams() | ||
); | ||
} | ||
} |
Oops, something went wrong.