From 83205c5ceb023bb29a3932dc56873d45d221633c Mon Sep 17 00:00:00 2001 From: mapserver2007 Date: Sat, 25 Jul 2020 13:07:09 +0900 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AE=9F=E8=A1=8C=E7=92=B0=E5=A2=83?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 13 +++++++++++++ docker-compose.yml | 15 +++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6c16186 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM php:7.4-cli +LABEL maintainer Ryuichi Tanaka + +RUN apt-get update && apt-get install -y \ + git + +RUN pecl install xdebug-2.9.6 && \ + docker-php-ext-enable xdebug + +RUN rm -rf /var/lib/apt/lists/* && rm -rf /tmp/pear && rm -rf /tmp/* && \ + apt-get clean -y && apt-get autoclean -y + +WORKDIR /workspace diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1997e07 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3' +services: + webstream-framework-container: + build: ./ + image: webstream-framework/container + container_name: webstream-framework-container + volumes: + - ./:/workspace + working_dir: /workspace + tty: true + networks: + - webstream_framework +networks: + webstream_framework: + external: true \ No newline at end of file From ee7e681cfa3bfe565f488812b31ca45587db1338 Mon Sep 17 00:00:00 2001 From: mapserver2007 Date: Sat, 25 Jul 2020 13:07:39 +0900 Subject: [PATCH 2/6] =?UTF-8?q?phpunit=E6=9B=B4=E6=96=B0=E3=80=81phpcs?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- phpcs.xml | 8 ++++++++ phpunit.xml | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 phpcs.xml diff --git a/composer.json b/composer.json index d81ac48..6c4563f 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { "require": { - "phpunit/phpunit": "6.*" + "phpunit/phpunit": "9.*" } } diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..2e14109 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,8 @@ + + + ./ + ./vendor/* + ./Test/* + + + diff --git a/phpunit.xml b/phpunit.xml index 041bfc8..89f6f36 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -11,6 +11,7 @@ ./Test ./Modules + ./vendor From 0883d75901a1e5a3074b9f93912d5cb0907902c3 Mon Sep 17 00:00:00 2001 From: mapserver2007 Date: Sat, 25 Jul 2020 13:07:55 +0900 Subject: [PATCH 3/6] =?UTF-8?q?scrutinizer=E8=A8=AD=E5=AE=9A=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .scrutinizer.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 37f6c15..57fbd8e 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -4,16 +4,16 @@ build: nodes: analysis: environment: - php: 7.0.20 + php: 7.3.0 tests: override: - - command: phpcs-run - use_website_config: true + - phpcs-run - php-scrutinizer-run filter: excluded_paths: - 'Test/*' + - 'Modules/*' tools: external_code_coverage: timeout: 2400 @@ -23,10 +23,11 @@ tools: enabled: false php_cs_fixer: config: - level: psr2 + level: psr12 filter: excluded_paths: - 'Test/*' + - 'Modules/*' php_mess_detector: config: rulesets: @@ -40,3 +41,4 @@ tools: filter: excluded_paths: - 'Test/*' + - 'Modules/*' From f31753ad7d3ca2f625acb86c62f2c6a2a95b4c3d Mon Sep 17 00:00:00 2001 From: mapserver2007 Date: Sat, 25 Jul 2020 13:08:13 +0900 Subject: [PATCH 4/6] =?UTF-8?q?travis.yml=E5=89=8A=E9=99=A4=E3=80=81github?= =?UTF-8?q?=20action=E8=A8=AD=E5=AE=9A=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/php.yml | 33 +++++++++++++++++++++++++++++++++ .travis.yml | 34 ---------------------------------- 2 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/php.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..c2bfc3c --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,33 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: nanasess/setup-php@master + with: + php-version: '7.4' + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + - name: Run test suite and calculate coverage + run: phpdbg -qrr vendor/bin/phpunit --configuration phpunit.xml --coverage-clover=coverage.clover + - name: Prepare send coverage + run: wget https://scrutinizer-ci.com/ocular.phar + - name: Send coverage report to scrutinizer + run: php ocular.phar code-coverage:upload --format=php-clover coverage.clover diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b171c9f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -sudo: required - -services: - - docker - -language: php - -cache: - directories: - - vendor - - $HOME/.composer/cache - -matrix: - fast_finish: true - include: - - php: 7.2 - env: VERSION=7.2 - - php: 7.1 - env: VERSION=7.1 - - php: 7.0 - env: VERSION=7.0 - -before_script: - - echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - composer install - - mkdir -p build/logs - -script: - - if [[ $VERSION > 7.0 ]]; then docker run -v /home/travis/build/webstream-framework/Container:/workspace/ --rm webstream/php-alpine:$VERSION phpdbg -qrr vendor/bin/phpunit --configuration phpunit.xml --coverage-clover=coverage.clover; - else docker run -v /home/travis/build/webstream-framework/Container:/workspace/ --rm webstream/php-alpine:$VERSION vendor/bin/phpunit --configuration phpunit.xml; fi - -after_script: - - if [[ $VERSION = 7.2 ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi - - if [[ $VERSION = 7.2 ]]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi From 604994fbdee01250a4071a598ce824dec4121174 Mon Sep 17 00:00:00 2001 From: mapserver2007 Date: Sat, 25 Jul 2020 13:08:23 +0900 Subject: [PATCH 5/6] =?UTF-8?q?Rakefile=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rakefile | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..a0d9d8c --- /dev/null +++ b/Rakefile @@ -0,0 +1,38 @@ +require 'yaml' + +def force_sh(cmd) + begin + sh cmd + rescue => e + puts e.message + end +end + +task :default => :create_dev + +task :create_dev => [:create_network, :prune] do + cmd = <<-EOS + docker-compose build + docker-compose down + docker-compose up -d + EOS + sh cmd +end + +task :create_dev_debug do + cmd = <<-EOS + docker-compose build + docker-compose down + docker-compose up + EOS + sh cmd +end + +task :prune do + force_sh 'docker volume prune -f > /dev/null 2>&1' + force_sh 'docker rmi -f $(docker images -f "dangling=true" -q) > /dev/null 2>&1' +end + +task :create_network do + force_sh 'docker network create --driver bridge webstream_framework' +end From fd1c00800e1faf69436c310c26f18caab56c4a86 Mon Sep 17 00:00:00 2001 From: mapserver2007 Date: Sat, 25 Jul 2020 13:08:38 +0900 Subject: [PATCH 6/6] =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=83=95?= =?UTF-8?q?=E3=82=A9=E3=83=BC=E3=83=9E=E3=83=83=E3=83=88=E9=81=A9=E7=94=A8?= =?UTF-8?q?=E3=80=81deprecated=E7=BD=AE=E3=81=8D=E6=8F=9B=E3=81=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Container.php | 1 + Test/ContainerTest.php | 19 ++++++++++--------- Test/Modules/InvalidArgumentException.php | 1 + Test/Providers/ContainerProvider.php | 5 +++-- ValueProxy.php | 1 + 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Container.php b/Container.php index 777fdc0..0d1d322 100644 --- a/Container.php +++ b/Container.php @@ -1,4 +1,5 @@ expectException(\WebStream\Exception\Extend\InvalidArgumentException::class); + $container = new Container(); $container->test1 = 1; $container->remove("test1"); @@ -83,12 +84,12 @@ public function okRegisterPrimitive($value, $result) */ public function okRegisterClosure() { - $func = function() { + $func = function () { return "test"; }; $container = new Container(); $container->register("test", $func); - $this->assertInternalType("object", $container->test); + $this->assertIsObject($container->test); $result = $container->test; $this->assertEquals($result(), "test"); } @@ -100,7 +101,7 @@ public function okRegisterClosure() */ public function okRegisterAsDynamic() { - $func = function() { + $func = function () { echo "evaluated"; return "test"; }; @@ -117,13 +118,13 @@ public function okRegisterAsDynamic() */ public function okRegisterAsLazy() { - $func = function() { + $func = function () { echo "evaluated"; return "test"; }; $container = new Container(); $container->registerAsLazy("test", $func); - $this->expectOutputString(null); + $this->expectOutputString(""); $this->assertEquals($container->test, "test"); $this->expectOutputString("evaluated"); } @@ -135,7 +136,7 @@ public function okRegisterAsLazy() */ public function okRegisterCached() { - $func = function() { + $func = function () { echo "evaluated"; return "test"; }; @@ -163,7 +164,7 @@ public function okRegisterCached() */ public function okRegisterUnCached() { - $func = function() { + $func = function () { echo "evaluated"; return "test"; }; diff --git a/Test/Modules/InvalidArgumentException.php b/Test/Modules/InvalidArgumentException.php index f059be0..62718ac 100644 --- a/Test/Modules/InvalidArgumentException.php +++ b/Test/Modules/InvalidArgumentException.php @@ -1,4 +1,5 @@