added test cases, remove activeClass from output if no target set
All checks were successful
CI / testsuite (sqlite, 8.2, ) (push) Successful in 12m46s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 12m35s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 10m20s
CI / Coding Standard & Static Analysis (push) Successful in 13m51s
CI / testsuite (mysql, 8.2, ) (push) Successful in 5m9s
CI / testsuite (mysql, 8.4, ) (push) Successful in 6m20s
CI / testsuite (pgsql, 8.2, ) (push) Successful in 5m16s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 5m51s
All checks were successful
CI / testsuite (sqlite, 8.2, ) (push) Successful in 12m46s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 12m35s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 10m20s
CI / Coding Standard & Static Analysis (push) Successful in 13m51s
CI / testsuite (mysql, 8.2, ) (push) Successful in 5m9s
CI / testsuite (mysql, 8.4, ) (push) Successful in 6m20s
CI / testsuite (pgsql, 8.2, ) (push) Successful in 5m16s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 5m51s
This commit is contained in:
@@ -25,6 +25,10 @@ class ActiveLinkHelperTest extends TestCase {
|
||||
'/',
|
||||
['controller' => 'Tests', 'action' => 'index'],
|
||||
);
|
||||
$routes->get(
|
||||
'/home',
|
||||
['controller' => 'Tests', 'action' => 'index'],
|
||||
);
|
||||
$routes->get(
|
||||
'/admin/users',
|
||||
['prefix' => 'Admin', 'controller' => 'Users', 'action' => 'index'],
|
||||
@@ -39,6 +43,20 @@ class ActiveLinkHelperTest extends TestCase {
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testLinkNoTargetSet(): void {
|
||||
$request = new ServerRequest(['url' => '/']);
|
||||
$view = new View($request);
|
||||
$helper = new ActiveLinkHelper($view);
|
||||
|
||||
$result = $helper->link('goto', '/', [
|
||||
'activeClass' => 'awesome-active-class',
|
||||
]);
|
||||
$this->assertStringNotContainsString('awesome-active-class', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testLinkMatchesString(): void {
|
||||
$request = new ServerRequest(['url' => '/']);
|
||||
@@ -50,6 +68,19 @@ class ActiveLinkHelperTest extends TestCase {
|
||||
'activeClass' => 'awesome-active-class',
|
||||
]);
|
||||
$this->assertStringContainsString('awesome-active-class', $result);
|
||||
$this->assertStringNotContainsString('activeClass', $result);
|
||||
|
||||
$request = new ServerRequest(['url' => '/home']);
|
||||
$view = new View($request);
|
||||
$helper = new ActiveLinkHelper($view);
|
||||
|
||||
$result = $helper->link('goto', '/', [
|
||||
'target' => '/',
|
||||
'activeClass' => 'awesome-active-class',
|
||||
]);
|
||||
$this->assertStringContainsString('awesome-active-class', $result);
|
||||
$this->assertStringNotContainsString('activeClass', $result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user