# A closer failure

I’ve updated the Route Pages plugin moving the core function forward. To cope with the need to persist meta information about each route and asynchronously retrieve that information later I’ve added a class extending the WP_Routing_PersistableRoute to the project. Being the class tailored to the plugin needs I’ve added it to the plugin and not to the wp-routing package that allows it all.

## Testing, testing and a close failure

I’m really developing the plugin in a TDD fashion and sharpening the tools at my disposal along the way, that makes the development move along not that fast I guess.
Without much fuss and introduction this is the first real test approaching the result I need:

<?php
use AcceptanceTester;

class PageGenerationCest
{
/**
* @test
* it should create a route page if a persisted route meta info is in the db
*/
public function it_should_create_a_route_page_if_a_persisted_route_meta_info_is_in_the_db(AcceptanceTester $I) { /** * Prepare */$routeMeta = mysql_escape_string(serialize(array('route-one' => array('title' => 'Route one', 'permalink' => 'route-one', 'generate' => 'page'))));
$data = array('option_name' => RoutePages_GeneratingRoute::OPTION_ID, 'option_value' =>$routeMeta, 'autoload' => 'yes');
$I->haveInDatabase('rp_options',$data);

// on activation and anytime page generation is triggered the plugin will call this method
// on this class so I'm not calling the whole plugin to test the functionality
$pageManager = new RoutePages_PageManager(); /** * Execute */$pageManager->createRoutePages();

/**
* Verify
*/
$I->loginAsAdmin();$I->amOnPagesPage();
\$I->see('Route one', '.page-title');
}
}

I’m using Codeception and the WP Browser extension and although the test is failing I will move into functional and unit testing from here to narrow down the problem and will hence call the actual failure a small victory.