Backend only WordPress 04

After some polishing I move on a little in the backend-only WordPress experiment.

Login and admin

After making sure the admin area is accessible using the /admin path I want to make sure the login part is as well.
To do so I’ve added some tests to the PhpBrowser powered BackendRedirectionCest class

<?php
use \AcceptanceTester;
use Symfony\Component\BrowserKit\Cookie;

class BackendRedirectionCest {

    /** @var  Cookie */
    protected static $authCookie;
    /** @var  Cookie */
    protected static $loginCookie;


    /**
     * @beforeClass
     */
    public static function runBefore( AcceptanceTester $I ) {
        $I->loginAsAdmin();
        self::$authCookie = $I->grabWordPressAuthCookie();
        self::$loginCookie = $I->grabWordPressLoginCookie();
    }

    protected function login( AcceptanceTester $I ) {
        $I->setCookie( self::$authCookie->getName(), self::$authCookie->getValue() );
        $I->setCookie( self::$loginCookie->getName(), self::$loginCookie->getValue() );
    }

    /**
     * @test
     * it should allow accessing the index going to the site root
     */
    public function it_should_allow_accessing_the_index_going_to_the_site_root( AcceptanceTester $I ) {
        $I->wantTo( "go to the index page accessing the root path" );
        $I->amOnPage( '/' );
        $I->seeElement( 'body.index' );
    }

    /**
     * @test
     * it should allow accessing the index pointing to it directly
     */
    public function it_should_allow_accessing_the_index_pointing_to_it_directly( AcceptanceTester $I ) {
        $I->wantTo( "go to the index page accessing the /index.php path" );
        $I->amOnPage( '/index.php' );
        $I->seeElement( 'body.index' );
    }

    /**
     * @test
     * it should redirect to WordPress login screen when trying to access admin w/o rights
     */
    public function it_should_redirect_to_word_press_login_screen_when_trying_to_access_admin_w_o_rights( AcceptanceTester $I ) {
        $I->wantTo( "be redirected to the WordPress login when trying to access /admin w/o rights" );
        $I->amOnPage( '/admin' );
        $I->seeElement( 'body.login' );
    }

    /**
     * @test
     * it should redirect to the admin area path when accessing /admin with rights
     */
    public function it_should_redirect_to_the_admin_area_when_accessing_admin_with_rights( AcceptanceTester $I ) {
        $I->wantTo( "go to the wp admin area using the /admin path" );
        $this->login( $I );
        $I->amOnPage( '/admin' );
        $I->seeElement( 'body.wp-admin' );
    }

    /**
     * @test
     * it should access admin area when using trailing slash
     */
    public function it_should_access_admin_area_when_using_trailing_slash(AcceptanceTester $I) {
        $I->wantTo( "go to the wp admin area using the /admin/ path" );
        $this->login( $I );
        $I->amOnPage( '/admin/' );
        $I->seeElement( 'body.wp-admin' );
    }

    /**
     * @test
     * it should cut queries on the /admin path
     */
    public function it_should_cut_queries_on_the_admin_path(AcceptanceTester $I) {
        $I->wantTo( "go to the /admin path and have query parameters ignored" );
        $this->login( $I );
        $I->amOnPage('/admin?foo=bar&some=var');
        $I->seeCurrentUrlMatches('~/wp/wp-admin/~');
    }

    /**
     * @test
     * it should access login when on /login path
     */
    public function it_should_access_login_when_on_login_path(AcceptanceTester $I) {
        $I->wantTo( "go to the login using the /login path" );
        $I->amOnPage('/login');
        $I->seeElement('body.login');
    }

    /**
     * @test
     * it should allow accessing the login using /login/ path
     */
    public function it_should_allow_accessing_the_login_using_login_path(AcceptanceTester $I) {
        $I->wantTo( "go to the login using the /login/ path" );
        $I->amOnPage('/login/');
        $I->seeElement('body.login');
    }

    /**
     * @test
     * it should allow accessing the admin area using the /wp/wp-admin path
     */
    public function it_should_allow_accessing_the_admin_area_using_the_wp_wp_admin_path(AcceptanceTester $I) {
        $I->wantTo( "go to the admin area using the /wp/wp-admin path" );
        $this->login( $I );
        $I->amOnPage('/wp/wp-admin');
        $I->seeElement('body.wp-admin');
    }

    /**
     * @test
     * it should allow accessing the admin area sub paths
     */
    public function it_should_allow_accessing_the_admin_area_sub_paths(AcceptanceTester $I) {
        $I->wantTo( "create a new post using the /wp/wp-admin/post-new.php path" );
        $this->login( $I );
        $I->amOnPage('/wp/wp-admin/post-new.php');
        $I->seeElement('body.wp-admin.post-new-php');
    }
}

and after some fiddling with the .htaccess file I could get all green lights on the tests
Green redirection tests
The tests also tell something on my intention to add an easy to remember way to access the administration area without removing the possibility to refer WordPress admin area paths the usual way: see the last two tests.
The final .htaccess file is the one below

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
R;ewriteRule ^admin.*$ /wp/wp-admin [L]
RewriteRule ^login.*$ /wp/wp-login.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php [L]

Next

The decision to use WordPress for the backend only implies I am not be able to use its routing capabilities and am on my own for that.
I’m considering some alternatives keeping in mind that I want to keep the project PHP 5.2 compatible and want to have a routing system capable of dealing with any request method and not just the GET one.

I appreciate your input