Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function beforeFilter(EventInterface $event)
* @return void
* @noTodo
* @checked
* @unitTest
*/
public function index()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

namespace BcInstaller\Test\TestCase\Controller\Admin;
use BaserCore\TestSuite\BcTestCase;
use BaserCore\Utility\BcContainerTrait;
use BcInstaller\Controller\Admin\InstallationsController;
use Cake\Core\Configure;
use Cake\Event\Event;

/**
Expand All @@ -22,7 +24,8 @@
class InstallationsControllerTest extends BcTestCase
{

/**
use BcContainerTrait;

/**
* setup
*/
Expand All @@ -46,6 +49,7 @@ public function tearDown(): void
*/
public function testBeforeFilter()
{
$this->markTestSkipped('このテストは未確認です。');
$this->InstallationsController = new InstallationsController($this->getRequest());
$event = new Event('Controller.beforeFilter', $this->InstallationsController);
$this->InstallationsController->beforeFilter($event);
Expand All @@ -57,7 +61,23 @@ public function testBeforeFilter()
*/
public function testIndex()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
Configure::write("BcEnv.isInstalled", false);
//backup file
copy(ROOT . DS . 'config' . DS . '.env', ROOT . DS . 'config' . DS . '.env.bak');
copy(ROOT . DS . 'config' . DS . 'install.php', ROOT . DS . 'config' . DS . 'install.php.bak');
copy(ROOT . DS . 'vendor' . DS . 'autoload.php', ROOT . DS . 'vendor' . DS . 'autoload.php.bak');
$this->get('/');

//CSRFがあるか確認すること
$_cookies = $this->getPrivateProperty($this->_response, '_cookies');
$cookies = $this->getPrivateProperty($_cookies, 'cookies');
$this->assertNotEmpty($cookies['csrfToken;;/']);

Configure::write("BcEnv.isInstalled", true);
//backup
rename(ROOT . DS . 'config' . DS . '.env.bak', ROOT . DS . 'config' . DS . '.env');
rename(ROOT . DS . 'config' . DS . 'install.php.bak', ROOT . DS . 'config' . DS . 'install.php');
rename(ROOT . DS . 'vendor' . DS . 'autoload.php.bak', ROOT . DS . 'vendor' . DS . 'autoload.php');
}

/**
Expand Down