Skip to content

Commit

Permalink
Merge pull request #370 from nanasess/modify-after-install
Browse files Browse the repository at this point in the history
/install ディレクトリの削除を促すよう修正
  • Loading branch information
okazy committed Feb 7, 2020
2 parents a164798 + 5b5ae16 commit 45f0037
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 17 deletions.
30 changes: 17 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,42 @@ env:
global:
- DBNAME=myapp_test DBSERVER=127.0.0.1 HTTP_URL=http://localhost:8085/ HTTPS_URL=http://localhost:8085/
matrix:
- DB=mysql USER=root DBPASS=' ' DBUSER=root
- DB=pgsql USER=postgres DBPASS=password DBUSER=postgres
- DB=pgsql USER=postgres DBPASS=password DBUSER=postgres COVERAGE=true # Use for coverage report
- DB=mysql USER=root DBPASS=' ' DBUSER=root DBPORT=3306
- DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432
- DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432 COVERAGE=true # Use for coverage report

matrix:
fast_finish: true
include:
- php: 5.4
dist: trusty
env: DB=mysql USER=root DBPASS=' ' DBUSER=root DIST=trusty
env: DB=mysql USER=root DBPASS=' ' DBUSER=root DBPORT=3306 DIST=trusty
- php: 5.4
dist: trusty
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DIST=trusty
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432 DIST=trusty
- php: 5.5
dist: trusty
env: DB=mysql USER=root DBPASS=' ' DBUSER=root DIST=trusty
env: DB=mysql USER=root DBPASS=' ' DBUSER=root DBPORT=3306 DIST=trusty
- php: 5.5
dist: trusty
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DIST=trusty
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432 DIST=trusty
exclude:
- php: 5.4
- php: 5.5
- php: 5.6
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres COVERAGE=true
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432 COVERAGE=true
- php: 7.0
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres COVERAGE=true
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432 COVERAGE=true
- php: 7.1
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres COVERAGE=true
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432 COVERAGE=true
- php: 7.2
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres COVERAGE=true
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432 COVERAGE=true
- php: 7.4
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres COVERAGE=true
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432 COVERAGE=true
allow_failures:
# Use for coverage report
- php: 7.3
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres COVERAGE=true
env: DB=pgsql USER=postgres DBPASS=password DBUSER=postgres DBPORT=5432 COVERAGE=true

before_install:
- if [[ $DIST = 'trusty' ]]; then sudo apt-get -y install google-chrome-stable --allow-unauthenticated ; fi
Expand Down Expand Up @@ -90,6 +90,10 @@ script:
- if [ ! $COVERAGE ] ; then php data/vendor/bin/codecept run --env chrome --skip-group installer --steps ; fi
- sed -e 's|http://|https://|g' -i.bak data/config/config.php
- if [ ! $COVERAGE ] ; then php data/vendor/bin/phpunit -c phpunit.xml.dist tests/class/SC_SessionFactoryTest.php ; fi
- rm ./data/config/config.php
- if [ $DB = 'pgsql' ] ; then psql -h ${DBSERVER} -U ${DBUSER} -p ${DBPORT} -c "DROP DATABASE ${DBNAME};"; psql -h ${DBSERVER} -U ${DBUSER} -p ${DBPORT} -c "CREATE DATABASE ${DBNAME};" ; fi
## Travis の mysql はパスワードが空なのでスキップ
- if [ ! $COVERAGE ] && [ $DB = 'pgsql' ] ; then php data/vendor/bin/codecept run --env chrome --group installer --steps ; fi

after_script:
- if [ $COVERAGE ] ; then php data/vendor/bin/coveralls -v ; fi
Expand Down
30 changes: 28 additions & 2 deletions ctests/acceptance/InstallerCept.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@
$I->click('次へ進む');

$I->see('データベースの初期化');
$I->waitForText('○:テーブルの作成に成功しました。', 30);
$I->waitForText('○:シーケンスの作成に成功しました。', 30);
$I->dontSee('×:テーブルの作成に失敗しました。');
$I->waitForText('○:テーブルの作成に成功しました。', 60);
$I->waitForText('○:シーケンスの作成に成功しました。', 60);
$I->click('次へ進む');

$I->expect('STEP4');
Expand All @@ -76,3 +77,28 @@
$I->click(['css' => '.btn-tool-format']);

$I->see('ログイン : 管理者 様');

$I->expect('TOPページを確認します');
$I->click(['id' => 'logo']);
$I->see('インストール完了後に /install フォルダを削除してください。');

$I->expect('/install/index.php を削除します');
$install_dir = __DIR__.'/../../html/install';
unlink($install_dir.'/'.DIR_INDEX_FILE);
$I->click(['id' => 'logo']);
$I->see('インストール完了後に /install フォルダを削除してください。');

$I->expect('/install を削除します');
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($install_dir, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($files as $file) {
/** @var SplFileInfo $file */
$file->isDir() ? rmdir($file->getPathname()) : unlink($file->getRealPath());
}
rmdir($install_dir);

$I->expect('/install が削除されていることを確認します');
$I->click(['id' => 'logo']);
$I->dontSee('インストール完了後に /install フォルダを削除してください。');
4 changes: 2 additions & 2 deletions data/class/util/SC_Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public static function sfInitInstall()
header('Location: ' . $install_url);
exit;
}
$path = HTML_REALDIR . 'install/' . DIR_INDEX_FILE;
$path = HTML_REALDIR . 'install';
if (file_exists($path)) {
SC_Utils_Ex::sfErrorHeader('>> /install/' . DIR_INDEX_FILE . ' は、インストール完了後にファイルを削除してください。');
SC_Utils_Ex::sfErrorHeader('>> インストール完了後に /install フォルダを削除してください。');
}
}

Expand Down

0 comments on commit 45f0037

Please sign in to comment.