Skip to content

Commit

Permalink
Merge pull request #4078 from thangnnmd/unitTest_BcInstallerPlugin_ro…
Browse files Browse the repository at this point in the history
…utes

BcInstallerPlugin::routes
  • Loading branch information
HungDV2022 authored Dec 20, 2024
2 parents 64602c7 + c02ae3c commit 658bab1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugins/bc-installer/src/BcInstallerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function services(ContainerInterface $container): void
* @param \Cake\Routing\RouteBuilder $routes
* @checked
* @noTodo
* @unitTest
*/
public function routes($routes): void
{
Expand Down
14 changes: 13 additions & 1 deletion plugins/bc-installer/tests/TestCase/BcInstallerPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use BcInstaller\Service\Admin\InstallationsAdminServiceInterface;
use BcInstaller\Service\InstallationsServiceInterface;
use Cake\Console\CommandCollection;
use Cake\Core\Configure;
use Cake\Core\Container;
use Cake\Routing\Router;

class BcInstallerPluginTest extends BcTestCase
{
Expand Down Expand Up @@ -40,7 +42,17 @@ public function test_services()
*/
public function test_routes()
{
$this->markTestIncomplete('Not implemented yet.');
Configure::write('BcEnv.isInstalled', false);
$routes = Router::createRouteBuilder('/install');
$this->BcInstallerPlugin->routes($routes);
$result = Router::parseRequest($this->getRequest('/install'));
$this->assertEquals('Installations', $result['controller']);

$routes = Router::createRouteBuilder('/');
$this->BcInstallerPlugin->routes($routes);
$result = Router::parseRequest($this->getRequest('/'));
$this->assertEquals('Installations', $result['controller']);
Configure::write('BcEnv.isInstalled', true);
}

/**
Expand Down

0 comments on commit 658bab1

Please sign in to comment.