Merge pull request #1537 from ArthurHoaro/fix/back-compatible-targets
This commit is contained in:
commit
46d3f8162b
4 changed files with 10 additions and 646 deletions
|
@ -46,10 +46,10 @@ class FeedController extends ShaarliVisitorController
|
|||
|
||||
$data = $this->container->feedBuilder->buildData($feedType, $request->getParams());
|
||||
|
||||
$this->executePageHooks('render_feed', $data, $feedType);
|
||||
$this->executePageHooks('render_feed', $data, 'feed.' . $feedType);
|
||||
$this->assignAllView($data);
|
||||
|
||||
$content = $this->render('feed.'. $feedType);
|
||||
$content = $this->render('feed.' . $feedType);
|
||||
|
||||
$cache->cache($content);
|
||||
|
||||
|
|
|
@ -17,15 +17,15 @@ class LegacyRouter
|
|||
|
||||
public static $PAGE_PICWALL = 'picwall';
|
||||
|
||||
public static $PAGE_TAGCLOUD = 'tagcloud';
|
||||
public static $PAGE_TAGCLOUD = 'tag.cloud';
|
||||
|
||||
public static $PAGE_TAGLIST = 'taglist';
|
||||
public static $PAGE_TAGLIST = 'tag.list';
|
||||
|
||||
public static $PAGE_DAILY = 'daily';
|
||||
|
||||
public static $PAGE_FEED_ATOM = 'atom';
|
||||
public static $PAGE_FEED_ATOM = 'feed.atom';
|
||||
|
||||
public static $PAGE_FEED_RSS = 'rss';
|
||||
public static $PAGE_FEED_RSS = 'feed.rss';
|
||||
|
||||
public static $PAGE_TOOLS = 'tools';
|
||||
|
||||
|
@ -37,7 +37,7 @@ class LegacyRouter
|
|||
|
||||
public static $PAGE_ADDLINK = 'addlink';
|
||||
|
||||
public static $PAGE_EDITLINK = 'edit_link';
|
||||
public static $PAGE_EDITLINK = 'editlink';
|
||||
|
||||
public static $PAGE_DELETELINK = 'delete_link';
|
||||
|
||||
|
@ -60,128 +60,4 @@ class LegacyRouter
|
|||
public static $PAGE_THUMBS_UPDATE = 'thumbs_update';
|
||||
|
||||
public static $GET_TOKEN = 'token';
|
||||
|
||||
/**
|
||||
* Reproducing renderPage() if hell, to avoid regression.
|
||||
*
|
||||
* This highlights how bad this needs to be rewrite,
|
||||
* but let's focus on plugins for now.
|
||||
*
|
||||
* @param string $query $_SERVER['QUERY_STRING'].
|
||||
* @param array $get $_SERVER['GET'].
|
||||
* @param bool $loggedIn true if authenticated user.
|
||||
*
|
||||
* @return string page found.
|
||||
*/
|
||||
public static function findPage($query, $get, $loggedIn)
|
||||
{
|
||||
$loggedIn = ($loggedIn === true) ? true : false;
|
||||
|
||||
if (empty($query) && !isset($get['edit_link']) && !isset($get['post'])) {
|
||||
return self::$PAGE_LINKLIST;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_LOGIN) && $loggedIn === false) {
|
||||
return self::$PAGE_LOGIN;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_PICWALL)) {
|
||||
return self::$PAGE_PICWALL;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_TAGCLOUD)) {
|
||||
return self::$PAGE_TAGCLOUD;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_TAGLIST)) {
|
||||
return self::$PAGE_TAGLIST;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_OPENSEARCH)) {
|
||||
return self::$PAGE_OPENSEARCH;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_DAILY)) {
|
||||
return self::$PAGE_DAILY;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_FEED_ATOM)) {
|
||||
return self::$PAGE_FEED_ATOM;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_FEED_RSS)) {
|
||||
return self::$PAGE_FEED_RSS;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_THUMBS_UPDATE)) {
|
||||
return self::$PAGE_THUMBS_UPDATE;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$AJAX_THUMB_UPDATE)) {
|
||||
return self::$AJAX_THUMB_UPDATE;
|
||||
}
|
||||
|
||||
// At this point, only loggedin pages.
|
||||
if (!$loggedIn) {
|
||||
return self::$PAGE_LINKLIST;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_TOOLS)) {
|
||||
return self::$PAGE_TOOLS;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_CHANGEPASSWORD)) {
|
||||
return self::$PAGE_CHANGEPASSWORD;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_CONFIGURE)) {
|
||||
return self::$PAGE_CONFIGURE;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_CHANGETAG)) {
|
||||
return self::$PAGE_CHANGETAG;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_ADDLINK)) {
|
||||
return self::$PAGE_ADDLINK;
|
||||
}
|
||||
|
||||
if (isset($get['edit_link']) || isset($get['post'])) {
|
||||
return self::$PAGE_EDITLINK;
|
||||
}
|
||||
|
||||
if (isset($get['delete_link'])) {
|
||||
return self::$PAGE_DELETELINK;
|
||||
}
|
||||
|
||||
if (isset($get[self::$PAGE_CHANGE_VISIBILITY])) {
|
||||
return self::$PAGE_CHANGE_VISIBILITY;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_PINLINK)) {
|
||||
return self::$PAGE_PINLINK;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_EXPORT)) {
|
||||
return self::$PAGE_EXPORT;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_IMPORT)) {
|
||||
return self::$PAGE_IMPORT;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_PLUGINSADMIN)) {
|
||||
return self::$PAGE_PLUGINSADMIN;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$PAGE_SAVE_PLUGINSADMIN)) {
|
||||
return self::$PAGE_SAVE_PLUGINSADMIN;
|
||||
}
|
||||
|
||||
if (startsWith($query, 'do=' . self::$GET_TOKEN)) {
|
||||
return self::$GET_TOKEN;
|
||||
}
|
||||
|
||||
return self::$PAGE_LINKLIST;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class FeedControllerTest extends TestCase
|
|||
static::assertSame('data', $data['content']);
|
||||
|
||||
static::assertArrayHasKey('loggedin', $param);
|
||||
static::assertSame('rss', $param['target']);
|
||||
static::assertSame('feed.rss', $param['target']);
|
||||
})
|
||||
;
|
||||
|
||||
|
@ -91,7 +91,7 @@ class FeedControllerTest extends TestCase
|
|||
static::assertSame('data', $data['content']);
|
||||
|
||||
static::assertArrayHasKey('loggedin', $param);
|
||||
static::assertSame('atom', $param['target']);
|
||||
static::assertSame('feed.atom', $param['target']);
|
||||
})
|
||||
;
|
||||
|
||||
|
@ -131,7 +131,7 @@ class FeedControllerTest extends TestCase
|
|||
static::assertSame('data', $data['content']);
|
||||
|
||||
static::assertArrayHasKey('loggedin', $param);
|
||||
static::assertSame('atom', $param['target']);
|
||||
static::assertSame('feed.atom', $param['target']);
|
||||
})
|
||||
;
|
||||
|
||||
|
|
|
@ -1,512 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Legacy;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Unit tests for Router
|
||||
*/
|
||||
class LegacyRouterTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test findPage: login page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageLoginValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_LOGIN,
|
||||
LegacyRouter::findPage('do=login', array(), false)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_LOGIN,
|
||||
LegacyRouter::findPage('do=login', array(), 1)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_LOGIN,
|
||||
LegacyRouter::findPage('do=login&stuff', array(), false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: login page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageLoginInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_LOGIN,
|
||||
LegacyRouter::findPage('do=login', array(), true)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_LOGIN,
|
||||
LegacyRouter::findPage('do=other', array(), false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: picwall page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPagePicwallValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_PICWALL,
|
||||
LegacyRouter::findPage('do=picwall', array(), false)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_PICWALL,
|
||||
LegacyRouter::findPage('do=picwall', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: picwall page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPagePicwallInvalid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_PICWALL,
|
||||
LegacyRouter::findPage('do=picwall&stuff', array(), false)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_PICWALL,
|
||||
LegacyRouter::findPage('do=other', array(), false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: tagcloud page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageTagcloudValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_TAGCLOUD,
|
||||
LegacyRouter::findPage('do=tagcloud', array(), false)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_TAGCLOUD,
|
||||
LegacyRouter::findPage('do=tagcloud', array(), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_TAGCLOUD,
|
||||
LegacyRouter::findPage('do=tagcloud&stuff', array(), false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: tagcloud page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageTagcloudInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_TAGCLOUD,
|
||||
LegacyRouter::findPage('do=other', array(), false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: linklist page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageLinklistValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_LINKLIST,
|
||||
LegacyRouter::findPage('', array(), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_LINKLIST,
|
||||
LegacyRouter::findPage('whatever', array(), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_LINKLIST,
|
||||
LegacyRouter::findPage('whatever', array(), false)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_LINKLIST,
|
||||
LegacyRouter::findPage('do=tools', array(), false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: tools page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageToolsValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_TOOLS,
|
||||
LegacyRouter::findPage('do=tools', array(), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_TOOLS,
|
||||
LegacyRouter::findPage('do=tools&stuff', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: tools page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageToolsInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_TOOLS,
|
||||
LegacyRouter::findPage('do=tools', array(), 1)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_TOOLS,
|
||||
LegacyRouter::findPage('do=tools', array(), false)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_TOOLS,
|
||||
LegacyRouter::findPage('do=other', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: changepasswd page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageChangepasswdValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_CHANGEPASSWORD,
|
||||
LegacyRouter::findPage('do=changepasswd', array(), true)
|
||||
);
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_CHANGEPASSWORD,
|
||||
LegacyRouter::findPage('do=changepasswd&stuff', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: changepasswd page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageChangepasswdInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_CHANGEPASSWORD,
|
||||
LegacyRouter::findPage('do=changepasswd', array(), 1)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_CHANGEPASSWORD,
|
||||
LegacyRouter::findPage('do=changepasswd', array(), false)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_CHANGEPASSWORD,
|
||||
LegacyRouter::findPage('do=other', array(), true)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Test findPage: configure page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageConfigureValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_CONFIGURE,
|
||||
LegacyRouter::findPage('do=configure', array(), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_CONFIGURE,
|
||||
LegacyRouter::findPage('do=configure&stuff', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: configure page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageConfigureInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_CONFIGURE,
|
||||
LegacyRouter::findPage('do=configure', array(), 1)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_CONFIGURE,
|
||||
LegacyRouter::findPage('do=configure', array(), false)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_CONFIGURE,
|
||||
LegacyRouter::findPage('do=other', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: changetag page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageChangetagValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_CHANGETAG,
|
||||
LegacyRouter::findPage('do=changetag', array(), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_CHANGETAG,
|
||||
LegacyRouter::findPage('do=changetag&stuff', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: changetag page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageChangetagInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_CHANGETAG,
|
||||
LegacyRouter::findPage('do=changetag', array(), 1)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_CHANGETAG,
|
||||
LegacyRouter::findPage('do=changetag', array(), false)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_CHANGETAG,
|
||||
LegacyRouter::findPage('do=other', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: addlink page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageAddlinkValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_ADDLINK,
|
||||
LegacyRouter::findPage('do=addlink', array(), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_ADDLINK,
|
||||
LegacyRouter::findPage('do=addlink&stuff', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: addlink page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageAddlinkInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_ADDLINK,
|
||||
LegacyRouter::findPage('do=addlink', array(), 1)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_ADDLINK,
|
||||
LegacyRouter::findPage('do=addlink', array(), false)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_ADDLINK,
|
||||
LegacyRouter::findPage('do=other', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: export page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageExportValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_EXPORT,
|
||||
LegacyRouter::findPage('do=export', array(), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_EXPORT,
|
||||
LegacyRouter::findPage('do=export&stuff', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: export page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageExportInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_EXPORT,
|
||||
LegacyRouter::findPage('do=export', array(), 1)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_EXPORT,
|
||||
LegacyRouter::findPage('do=export', array(), false)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_EXPORT,
|
||||
LegacyRouter::findPage('do=other', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: import page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageImportValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_IMPORT,
|
||||
LegacyRouter::findPage('do=import', array(), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_IMPORT,
|
||||
LegacyRouter::findPage('do=import&stuff', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: import page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageImportInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_IMPORT,
|
||||
LegacyRouter::findPage('do=import', array(), 1)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_IMPORT,
|
||||
LegacyRouter::findPage('do=import', array(), false)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_IMPORT,
|
||||
LegacyRouter::findPage('do=other', array(), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: editlink page output.
|
||||
* Valid: page should be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageEditlinkValid()
|
||||
{
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_EDITLINK,
|
||||
LegacyRouter::findPage('whatever', array('edit_link' => 1), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_EDITLINK,
|
||||
LegacyRouter::findPage('', array('edit_link' => 1), true)
|
||||
);
|
||||
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_EDITLINK,
|
||||
LegacyRouter::findPage('whatever', array('post' => 1), true)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
LegacyRouter::$PAGE_EDITLINK,
|
||||
LegacyRouter::findPage('whatever', array('post' => 1, 'edit_link' => 1), true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test findPage: editlink page output.
|
||||
* Invalid: page shouldn't be return.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFindPageEditlinkInvalid()
|
||||
{
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_EDITLINK,
|
||||
LegacyRouter::findPage('whatever', array('edit_link' => 1), false)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_EDITLINK,
|
||||
LegacyRouter::findPage('whatever', array('edit_link' => 1), 1)
|
||||
);
|
||||
|
||||
$this->assertNotEquals(
|
||||
LegacyRouter::$PAGE_EDITLINK,
|
||||
LegacyRouter::findPage('whatever', array(), true)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue