/** * Returns logout button * * @param boolean $redirect * * @return \Twig_Markup */ public function displayLogout($redirect) { $target = ''; // empty target if ($redirect) { $target = '?redirect=' . urlencode($this->app['resources']->getUrl('current')); } $context = ['providers' => ['logout' => ['link' => $this->app['resources']->getUrl('root') . $this->config->getUriBase() . '/logout' . $target, 'label' => $this->config->getLabel('logout') ?: 'Logout', 'class' => 'logout']]]; $html = $this->app['render']->render($this->config->getTemplate('button'), $context); return new \Twig_Markup($html, 'UTF-8'); }
public function testGetLabel() { $config = new Config(array(), 'http://example.com'); $this->assertSame('Logout', $config->getLabel('logout')); }