Skip to content

Commit

Permalink
Merge pull request #453 from nanasess/fix-phpfpm
Browse files Browse the repository at this point in the history
ADMIN_DIR をランダム文字列でテストする
  • Loading branch information
okazy authored Apr 8, 2021
2 parents 0cfeb4d + c99a64c commit c122ec9
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 37 deletions.
67 changes: 54 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-18.04 ]
php: [ 5.4, 5.5, 5.6, 7.1, 7.2, 7.3, 7.4, 8.0 ]
php: [ '5.4', '5.5', '5.6', '7.1', '7.2', '7.3', '7.4', '8.0' ]
db: [ mysql, pgsql ]
include:
- db: mysql
Expand Down Expand Up @@ -75,9 +75,33 @@ jobs:
uses: nanasess/setup-php@master
with:
php-version: ${{ matrix.php }}
- name: Setup PHP5.6
if: matrix.php == '5.6'
run: sudo apt-fast install -y php5.6-fpm
- name: php-fpm
env:
PHP_VERSION: ${{ matrix.php }}
run: |
if [ -f /lib/systemd/system/php${PHP_VERSION}-fpm.service ]
then
sudo systemctl enable php${PHP_VERSION}-fpm
fi
- name: Install symfony/cli
# server:ca:install でエラーは出るが利用可能
continue-on-error: true
run: |
sudo apt-fast -y install libnss3-tools
wget https://get.symfony.com/cli/installer -O - | bash
sudo mv ~/.symfony/bin/symfony /usr/local/bin/symfony
symfony local:php:list
symfony server:ca:install
- name: Install to Composer
run: composer install --no-interaction -o
- name: Create ADMIN_DIR
run: |
sudo apt-fast install -y sharutils
echo "ADMIN_DIR=$(head -c 10 < /dev/random | uuencode -m - | tail -n 2 |head -n 1 | sed 's,[/+],_,g' | head -c10)/" >> $GITHUB_ENV
- name: Setup to EC-CUBE
env:
Expand All @@ -87,8 +111,8 @@ jobs:
DBPASS: ${{ matrix.dbpass }}
DBNAME: ${{ matrix.dbname }}
DBPORT: ${{ matrix.dbport }}
HTTP_URL: http://localhost:8085/
HTTPS_URL: http://localhost:8085/
HTTP_URL: https://localhost:8085/
HTTPS_URL: https://localhost:8085/
run: |
sudo apt-fast install -y mysql-client postgresql-client
./eccube_install.sh ${DB}
Expand All @@ -102,10 +126,7 @@ jobs:
- name: Run to PHPUnit classloader
run: data/vendor/bin/phpunit --group classloader
- name: Run to PHPUnit SessionFactory
run: |
sed 's|http://|https://|g' -i.bak data/config/config.php
data/vendor/bin/phpunit tests/class/SC_SessionFactoryTest.php
- run: mv data/config/config.php.bak data/config/config.php
run: data/vendor/bin/phpunit tests/class/SC_SessionFactoryTest.php

- name: Run chromedriver
run: |
Expand All @@ -123,11 +144,12 @@ jobs:
DBNAME: ${{ matrix.dbname }}
DBPORT: ${{ matrix.dbport }}
DBSERVER: 127.0.0.1
HTTP_URL: http://localhost:8085/
HTTPS_URL: http://localhost:8085/
HTTP_URL: https://localhost:8085/
HTTPS_URL: https://localhost:8085/
run: |
mv html/admin html/${ADMIN_DIR}
php data/vendor/bin/codecept build
php -S 0.0.0.0:8085 -t html/ &
symfony serve -d --allow-http --port=8085 --document-root=html
php data/vendor/bin/codecept run --env chrome --skip-group installer --steps
- name: Upload evidence
if: failure()
Expand Down Expand Up @@ -278,6 +300,25 @@ jobs:
uses: nanasess/setup-php@master
with:
php-version: ${{ matrix.php }}
- name: php-fpm
env:
PHP_VERSION: ${{ matrix.php }}
run: |
if [ -f /lib/systemd/system/php${PHP_VERSION}-fpm.service ]
then
sudo systemctl enable php${PHP_VERSION}-fpm
fi
- name: Install symfony/cli
# server:ca:install でエラーは出るが利用可能
continue-on-error: true
run: |
sudo apt-fast -y install libnss3-tools
wget https://get.symfony.com/cli/installer -O - | bash
sudo mv ~/.symfony/bin/symfony /usr/local/bin/symfony
symfony local:php:list
symfony server:ca:install
- name: Install to Composer
run: composer install --no-interaction -o
Expand Down Expand Up @@ -328,11 +369,11 @@ jobs:
DBNAME: ${{ matrix.dbname }}
DBPORT: ${{ matrix.dbport }}
DBSERVER: 127.0.0.1
HTTP_URL: http://localhost:8085/
HTTPS_URL: http://localhost:8085/
HTTP_URL: https://localhost:8085/
HTTPS_URL: https://localhost:8085/
run: |
php data/vendor/bin/codecept build
php -S 0.0.0.0:8085 -t html/ &
symfony serve -d --allow-http --port=8085 --document-root=html
php data/vendor/bin/codecept run --env chrome --group installer --steps acceptance InstallerCept
- name: Upload evidence
Expand Down
4 changes: 2 additions & 2 deletions ctests/acceptance.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ modules:
url: 'http://localhost:8085/'
WebDriver:
browser: chrome
url: 'http://localhost:8085/'
url: 'https://localhost:8085/'
host: 'localhost'
port: 9515
window_size: 1680x3000
Expand All @@ -26,7 +26,7 @@ modules:
unexpectedAlertBehaviour: 'accept'
elementScrollBehavior: 1
chromeOptions:
args: ["--no-sandbox", "--disable-dev-shm-usage", "--disable-gpu"]
args: ["--allow-insecure-localhost", "--no-sandbox", "--disable-dev-shm-usage", "--disable-gpu"]
MailCatcherGuzzle5:
url: 'http://127.0.0.1'
port: '1080'
Expand Down
6 changes: 3 additions & 3 deletions ctests/acceptance/InstallerCept.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
$I = new AcceptanceTester($scenario);
$faker = Codeception\Util\Fixtures::get('faker');
$I->wantTo('正常にインストール可能か検証する');
// $I->amOnPage('/');
$I->amOnPage('/install/');
// $I->amOnPage('/'.DIR_INDEX_FILE);
$I->amOnPage('/install/'.DIR_INDEX_FILE);
$I->seeInCurrentUrl('/install/');
$I->see('EC-CUBEのインストールを開始します。');
$I->click('次へ進む');
Expand Down Expand Up @@ -77,7 +77,7 @@
$I->click('管理画面へログインする');

$I->wait(1);
$I->seeInCurrentUrl('/'.$admindirectory);
$I->seeInCurrentUrl('/'.$admindirectory.'/'.DIR_INDEX_FILE);
$I->fillField('input[name=login_id]', $user);
$I->fillField('input[name=password]', $password);
$I->click(['css' => '.btn-tool-format']);
Expand Down
2 changes: 1 addition & 1 deletion ctests/acceptance/WelcomeCept.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('TOPページが正常に見られているかを確認する。');
$I->amOnPage('/');
$I->amOnPage('/'.DIR_INDEX_FILE);
$I->see('EC-CUBE発!世界中を旅して見つけた立方体グルメを立方隊長が直送!');
$I->seeElement('#site_description');

Expand Down
2 changes: 1 addition & 1 deletion ctests/acceptance/admin/AdminHomeCept.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('管理画面に正常にログインできるかを確認する');
$I->amOnPage('/admin');
$I->amOnPage('/'.ADMIN_DIR.'/'.DIR_INDEX_FILE);

$I->fillField('input[name=login_id]', 'admin');
$I->fillField('input[name=password]', 'password');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$I = new AcceptanceTester($scenario);
$I->wantTo('おすすめ商品管理を確認する');
$I->amOnPage('/admin/index.php');
$I->amOnPage('/'.ADMIN_DIR.'/'.DIR_INDEX_FILE);

$I->fillField('input[name=login_id]', 'admin');
$I->fillField('input[name=password]', 'password');
Expand All @@ -11,7 +11,7 @@
$I->see('ログイン : 管理者 様');

$I->amGoingTo('コンテンツ管理>おすすめ商品管理');
$I->amOnPage('/admin/contents/recommend.php');
$I->amOnPage('/'.ADMIN_DIR.'/contents/recommend.php');

$I->expect('おすすめ商品の編集を確認する');
$I->click(['css' => '#admin-contents > div:nth-child(2) > table > tbody > tr:nth-child(2) > td:nth-child(3) > a']); // 編集ボタン
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$I = new AcceptanceTester($scenario);
$I->wantTo('プラグインの prefilterTransform が正常に動作するかを確認する');
$I->amOnPage('/admin');
$I->amOnPage('/'.ADMIN_DIR.'/'.DIR_INDEX_FILE);

$I->fillField('input[name=login_id]', 'admin');
$I->fillField('input[name=password]', 'password');
Expand All @@ -11,7 +11,7 @@
$I->see('ログイン : 管理者 様');

$I->amGoingTo('オーナーズストア>プラグイン管理');
$I->amOnPage('/admin/ownersstore/');
$I->amOnPage('/'.ADMIN_DIR.'/ownersstore/'.DIR_INDEX_FILE);

$I->expect('プラグインを圧縮します');

Expand All @@ -34,7 +34,7 @@
$I->seeInPopup('プラグインをインストールしました');
$I->acceptPopup();

$I->amOnPage('/admin/ownersstore/');
$I->amOnPage('/'.ADMIN_DIR.'/ownersstore/'.DIR_INDEX_FILE);

$I->expect('プラグインを有効化します');
$I->click(['css' => '#system > table.system-plugin > tbody > tr:nth-child(2) > td.plugin_info > div > label > input[type=checkbox]']); // 有効化ボタン
Expand All @@ -52,7 +52,7 @@
$I->seeInSource('<p>プラグイン仕様書の記述方法</p>');
$I->seeInSource('<p>一部のプラグインは完全一致が使用されている</p>');

$I->amOnPage('/admin/ownersstore/');
$I->amOnPage('/'.ADMIN_DIR.'/ownersstore/'.DIR_INDEX_FILE);
$I->expect('プラグインを無効化します');
$I->click(['css' => '#system > table.system-plugin > tbody > tr:nth-child(2) > td.plugin_info > div > label > input[type=checkbox]']); // 無効化ボタン

Expand Down
13 changes: 6 additions & 7 deletions ctests/acceptance/admin/total/AdminTotalCept.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$scenario->skip('Freetype not supported.');
}
$I->wantTo('売上集計画面を確認する');
$I->amOnPage('/admin');
$I->amOnPage('/'.ADMIN_DIR.'/'.DIR_INDEX_FILE);

$I->fillField('input[name=login_id]', 'admin');
$I->fillField('input[name=password]', 'password');
Expand All @@ -13,7 +13,7 @@
$I->see('ログイン : 管理者 様');

$I->amGoingTo('売上集計>期間別集計');
$I->amOnPage('/admin/total/?page=term');
$I->amOnPage('/'.ADMIN_DIR.'/total/'.DIR_INDEX_FILE.'?page=term');

$I->expect('日付の初期値を確認する');
$I->seeInField('select[name=search_startyear_m]', date('Y'));
Expand Down Expand Up @@ -74,7 +74,7 @@


$I->amGoingTo('売上集計>商品別集計');
$I->amOnPage('/admin/total/?page=products');
$I->amOnPage('/'.ADMIN_DIR.'/total/'.DIR_INDEX_FILE.'?page=products');

$I->expect('日付の初期値を確認する');
$I->seeInField('select[name=search_startyear_m]', date('Y'));
Expand Down Expand Up @@ -122,7 +122,7 @@


$I->amGoingTo('売上集計>年代別集計');
$I->amOnPage('/admin/total/?page=age');
$I->amOnPage('/'.ADMIN_DIR.'/total/'.DIR_INDEX_FILE.'?page=age');

$I->expect('日付の初期値を確認する');
$I->seeInField('select[name=search_startyear_m]', date('Y'));
Expand Down Expand Up @@ -170,7 +170,7 @@


$I->amGoingTo('売上集計>職業別集計');
$I->amOnPage('/admin/total/?page=job');
$I->amOnPage('/'.ADMIN_DIR.'/total/'.DIR_INDEX_FILE.'?page=job');

$I->expect('日付の初期値を確認する');
$I->seeInField('select[name=search_startyear_m]', date('Y'));
Expand Down Expand Up @@ -204,7 +204,7 @@


$I->amGoingTo('売上集計>会員別集計');
$I->amOnPage('/admin/total/?page=member');
$I->amOnPage('/'.ADMIN_DIR.'/total/'.DIR_INDEX_FILE.'?page=member');

$I->expect('日付の初期値を確認する');
$I->seeInField('select[name=search_startyear_m]', date('Y'));
Expand Down Expand Up @@ -235,4 +235,3 @@
$I->click('CSVダウンロード');
$file = $I->getLastDownloadFile('/^total\d{12}\.csv$/');
$I->assertTrue(count(file($file)) >= 2, '2行以上のファイルがダウンロードされている');

2 changes: 1 addition & 1 deletion html/install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ function lfDispComplete($objPage)
$objPage->tpl_sslurl = $secure_url;
//EC-CUBEオフィシャルサイトからのお知らせURL
$objPage->install_info_url = INSTALL_INFO_URL;
$objPage->admin_dir = $objWebParam->getValue('admin_dir');
$objPage->admin_dir = $objWebParam->getValue('admin_dir').'/';
return $objPage;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/require.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
if (!class_exists('PHPUnit_Framework_TestCase')) {
class_alias('PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase');
}
defined('HTTP_URL') or define('HTTP_URL', 'http://example.com/');
defined('HTTP_URL') or define('HTTP_URL', getenv('HTTP_URL') ? getenv('HTTP_URL') : 'http://example.com/');
defined('HTTPS_URL') or define('HTTPS_URL', HTTP_URL);
defined('ROOT_URLPATH') or define('ROOT_URLPATH', '/');
defined('ADMIN_DIR') or define('ADMIN_DIR', '');
defined('ROOT_URLPATH') or define('ROOT_URLPATH', getenv('ROOT_URLPATH') ? getenv('ROOT_URLPATH') : '/');
defined('ADMIN_DIR') or define('ADMIN_DIR', getenv('ADMIN_DIR') ? getenv('ADMIN_DIR') : '');
defined('HTML_REALDIR') or define('HTML_REALDIR', __DIR__.'/../html/');
require_once __DIR__.'/../html/define.php';
defined('DATA_REALDIR') or define('DATA_REALDIR', HTML_REALDIR . HTML2DATA_DIR);
Expand Down

0 comments on commit c122ec9

Please sign in to comment.