/** * @covers Starter\routers\TraitStarterRouter::show_result */ public function test_show_result() { $method = new \ReflectionMethod($this->router, 'show_result'); $method->setAccessible(true); $response = new GetResponse(); $response->blocks['left'] = ''; $response->blocks['main'] = ''; $response->blocks['header'] = ''; ob_start(); \Starter::$current_router = AdminPanelRouter::class; $method->invoke($this->router, $response); \Starter::$current_router = SiteRouter::class; $method->invoke($this->router, $response); ob_end_clean(); self::assertNull(error_get_last()); }
<?php use common\classes\GetResponse; class SilentAdminPanelRouter extends \Starter\routers\AdminPanelRouter { public function __destruct() { } protected function show_result(GetResponse $response) { } } \Starter::$current_router = \Starter\routers\AdminPanelRouter::class; /** * Class AdminPanelRouterTest * */ class AdminPanelRouterTest extends PHPUnit_Framework_TestCase { /** * @var $router \Starter\routers\AdminPanelRouter */ private $router; public function setUp() { $this->router = new SilentAdminPanelRouter(); } /** * @covers \Starter\routers\AdminPanelRouter::__construct */ public function test_construct()