public function testWithBasePath() { $config = array(); $routes = array('base_path' => '/testing', 'routes' => array('/another/:num' => array('controller' => 'test', 'action' => 'another'), '/custom/(.+?)/(.+?)' => array('controller' => 'test', 'action' => 'custom'), '/something/:any' => array('controller' => 'test', 'action' => 'something'), '/:any' => array('controller' => 'test'))); EE::init($config, $routes); $this->assertSame($routes, EE::get('_routes')); // Default index route $this->assertSame('index', EE::load_page(false, '/testing/')); // Auto mapped route $this->assertSame('foobarbaz', EE::load_page(false, '/testing/foobar')); // Not existing route $this->assertSame('Not Found', EE::load_page(false, '/testing/non_existing_url')); // Mapped route $this->assertSame('something', EE::load_page(false, '/testing/something')); // Dynamic Mapped route $this->assertSame('another ', EE::load_page(false, '/testing/another/')); // Dynamic Mapped route $this->assertSame('another 2', EE::load_page(false, '/testing/another/2')); // Custom route $this->assertSame('regex-here', EE::load_page(false, '/testing/custom/regex/here')); }
<?php // Bootstrap file // Require main framework class require dirname(__FILE__) . '/ee.php'; // Initialize and load configs/routes EE::init(); // Load and execute page EE::load_page();