Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental/phpstan level 6 fixes #9

Closed
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ RUN apt update \
&& echo "en_US.UTF-8 UTF-8" >/etc/locale.gen \
&& locale-gen \
;
RUN pecl search xdebug-2.9.8 \
&& pecl install xdebug-2.9.8

RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j$(nproc) zip gd mysqli pdo_mysql opcache intl pgsql pdo_pgsql \
&& docker-php-ext-enable xdebug \
;

RUN pecl install apcu && echo "extension=apcu.so" > /usr/local/etc/php/conf.d/apc.ini
Expand Down
2 changes: 1 addition & 1 deletion app/config/eccube/packages/dev/web_profiler.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
web_profiler:
toolbar: true
toolbar: false
intercept_redirects: false

framework:
Expand Down
4 changes: 2 additions & 2 deletions codeception/acceptance.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ modules:
host: '%WEB_DRIVER_HOST%'
port: '%WEB_DRIVER_PORT%'
url: '%BASE_URL%' # テスト対象のurl
window_size: 1680x3000
window_size: 1920x1680
wait: 10
capabilities:
unexpectedAlertBehaviour: 'accept'
Expand Down Expand Up @@ -68,6 +68,6 @@ env:
browser: chrome
capabilities:
chromeOptions:
args: ["--headless", "--disable-gpu"]
args: ["--window-size=1920,1680", "--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage"]
prefs:
download.default_directory: '%PWD%/codeception/_support/_downloads'
97 changes: 97 additions & 0 deletions codeception/acceptance/Plugin/PluginVerifyCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php


namespace Plugin;

use AcceptanceTester;
use Codeception\Util\Fixtures;
use Eccube\Common\EccubeConfig;

/**
* @group plugin_verify
*/
class PluginVerifyCest
{
/** @var EccubeConfig */
private $config;
/** プラグインコード */
private $plugin_code;

public function _before(AcceptanceTester $I){
if(!file_exists(__DIR__ . "/../../../var/cache/dev/htmlpurifier")){
mkdir(__DIR__ . "/../../../var/cache/dev/htmlpurifier", 775);
}
exec("php bin/console cache:clear --no-warmup");
$this->config = Fixtures::get('test_config');
$I->loginAsAdmin();
}
public function 認証キーを入力(AcceptanceTester $I)
{
$I->amOnPage('/admin/store/plugin/authentication_setting');
$config = Fixtures::get('test_config');
$I->fillField('/html/body/div[1]/div[3]/form/div[1]/div/div[2]/div/div[2]/div[2]/div[2]/input', $config['ECCUBE_PLUGIN_VERIFY_KEY']);
$I->click("/html/body/div[1]/div[3]/form/div[2]/div/div/div[2]/div/div/button");
$I->wait(5);
$I->see('保存しました');
}
public function プラグイン_インストール(AcceptanceTester $I){
$I->amOnPage("/admin/store/plugin");
$config = Fixtures::get('test_config');
$pluginName = $config['ECCUBE_PLUGIN_VERIFY_NAME'];
$I->see($pluginName);
$span = '//*[@id="page_admin_store_plugin"]/div[1]/div[3]/div[2]/div/div/div[1]/div[2]/table/tbody/tr/td[1]/div/span[text() = "'.$pluginName.'"]';
$tr = $span . '/ancestor::tr';
$this->plugin_code= $I->grabTextFrom($tr . "/td[3]/p");
echo("プラグインコード:" . $this->plugin_code . "\n");
$button = $tr . '/td[5]/a';
$I->click($button);
$I->wait(3);
$I->see("インストール確認");
$I->click("/html/body/div[1]/div[3]/div[2]/div/div/div/div[2]/div[2]/div/button[2]");
$I->wait(1);
$I->click("/html/body/div[1]/div[3]/div[3]/div/div/div[3]/button[2]");
//インストール処理が終わるまで待機
$I->waitForJS("return $.active == 0;", 60);
$I->see("インストールが完了しました。");
$I->click("/html/body/div[1]/div[3]/div[3]/div/div/div[3]/a");
}
public function プラグイン_有効化(AcceptanceTester $I){
$I->amOnPage("/admin/store/plugin");
//ステータスを確認
$config = Fixtures::get('test_config');
$span = '//*[@id="page_admin_store_plugin"]/div[1]/div[3]/div[2]/div/div/div[1]/div[2]/table/tbody/tr/td[3]/p[text() = "'.$this->plugin_code.'"]';
$tr = $span . '/ancestor::tr';
$status = $tr . '/td[4]/span';
$status_text = $I->grabTextFrom($status);
echo("プラグインのステータス:". $status_text ."\n");
$activateButton = $tr . '/td[6]/div/div[2]/a';
$I->click($activateButton);
$I->wait(3);
$I->see("を有効にしました");
}
public function プラグイン_無効化(AcceptanceTester $I){
$I->amOnPage("/admin/store/plugin");
$span = '//*[@id="page_admin_store_plugin"]/div[1]/div[3]/div[2]/div/div/div[1]/div[2]/table/tbody/tr/td[3]/p[text() = "'.$this->plugin_code.'"]';
$tr = $span . '/ancestor::tr';
$status = $tr . '/td[4]/span';
$status_text = $I->grabTextFrom($status);
echo("プラグインのステータス:". $status_text ."\n");
$disableButton = $tr . '/td[6]/div/div[2]/a';
$I->click($disableButton);
$I->wait(3);
$I->see("を無効にしました");
}
public function プラグイン_削除(AcceptanceTester $I){
$I->amOnPage("/admin/store/plugin");
$span = '//*[@id="page_admin_store_plugin"]/div[1]/div[3]/div[2]/div/div/div[1]/div[2]/table/tbody/tr/td[3]/p[text() = "'.$this->plugin_code.'"]';
$tr = $span . '/ancestor::tr';
$uninstallButton = $tr . '/td[6]/div/div[1]/a';
$I->click($uninstallButton);
$I->wait(1);
$I->click("/html/body/div[1]/div[3]/div[2]/div/div/div[1]/div[3]/div/div/div[3]/button[2]");
$I->waitForJS("return $.active == 0;", 60);
$I->see("削除が完了しました。");
$I->click('//*[@id="officialPluginDeleteModal"]/div/div/div[3]/button[3]');
$I->wait(3);
}
}
2 changes: 2 additions & 0 deletions codeception/acceptance/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ fixture_customer_num = 10 ; 各カスタマー作成時に注文を1つづつ
fixture_product_num = 20
fixture_order_num = 25
hostname = 'eccube4' ; 対象EC-CUBE4が稼働しているサーバーのホスト名
ECCUBE_PLUGIN_VERIFY_NAME = "構造化マークアッププラグイン(4.2系)"
ECCUBE_PLUGIN_VERIFY_KEY = d285840e84bb5ab7c5650250818a75970877c761
11 changes: 11 additions & 0 deletions codeception/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM codeception/codeception
CMD echo "W"
RUN apt-get update && apt install -y netcat

CMD echo "W"
COPY docker-php-entrypoint.sh /usr/local/bin/
WORKDIR /var/www/html



ENTRYPOINT ["/usr/local/bin/docker-php-entrypoint.sh"]
4 changes: 4 additions & 0 deletions codeception/docker/docker-php-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

while ! nc -z ec-cube 80; do sleep 1; done; while ! nc -z chrome 4444; do sleep 1; done; ls -la && php bin/console cache:clear --no-warmup && /var/www/html/vendor/bin/codecept run -d acceptance --env chrome-headless,local -g customer

14 changes: 13 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"doctrine/persistence": "^2.5",
"easycorp/easy-log-handler": "^1.0",
"ec-cube/plugin-installer": "^2.0",
"ec-cube/relatedproduct42": "^4.2",
"egulias/email-validator": "^2.1",
"exercise/htmlpurifier-bundle": "^3.1",
"friendsofphp/php-cs-fixer": "^3.8",
Expand Down Expand Up @@ -186,7 +187,7 @@
},
"config": {
"platform": {
"php": "7.4.0"
"php": "8.1.18"
},
"preferred-install": {
"*": "dist"
Expand All @@ -199,5 +200,16 @@
"ec-cube/plugin-installer": true,
"symfony/flex": true
}
},
"repositories": {
"eccube": {
"type": "composer",
"url": "https://package-api-c2.ec-cube.net/v42",
"options": {
"http": {
"header": ["X-ECCUBE-KEY: d285840e84bb5ab7c5650250818a75970877c761"]
}
}
}
}
}
59 changes: 40 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions docker-compose.codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "3"

volumes:
mailcatcher-data:
driver: local

services:
codeception:
build: ./codeception/docker
environment:
APP_ENV: "codeception"
volumes:
- .:/var/www/html
depends_on:
- chrome
- ec-cube
links:
- chrome
- ec-cube
networks:
- backend
deploy:
resources:
limits:
memory: 16G
reservations:
memory: 16G
chrome:
image: selenium/standalone-chrome
volumes:
- ./codeception/_support/_downloads:/var/www/html/codeception/_support/_downloads
networks:
- backend
deploy:
resources:
limits:
memory: 16G
reservations:
memory: 16G
9 changes: 5 additions & 4 deletions docker-compose.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ services:
### ローカルでビルドする場合は以下のコマンドを使用します
## docker build -t ec-cube --no-cache --pull --build-arg TAG=8.1-apache .
## docker tag ec-cube ghcr.io/ec-cube/ec-cube-php:8.1-apache
image: ${REGISTRY:-ghcr.io}/${IMAGE_NAME:-ec-cube/ec-cube-php}:${TAG:-8.1-apache}
# image: ${REGISTRY:-ghcr.io}/${IMAGE_NAME:-ec-cube/ec-cube-php}:${TAG:-8.1-apache}
build:
context: .
ports:
- 8080:80
- 4430:443
volumes:
### 同期対象からコストの重いフォルダを除外 #####################
- "var:/var/www/html/var"
- "vendor:/var/www/html/vendor"
- "node_modules:/var/www/html/node_modules"
- ".:/var/www/html"
# - "./var/coverage:/opt/coverage"
environment:
# EC-CUBE environments
APP_ENV: "dev"
Expand Down
Loading
Loading