From 259a7bddb01ad8760c837fa806131b58508ea4a9 Mon Sep 17 00:00:00 2001 From: neveldo Date: Fri, 24 Jul 2020 17:48:02 +0200 Subject: [PATCH 01/12] init ci --- .github/workflows/ci.yml | 12 ++++++++++++ Makefile | 3 +++ phpunit.xml.dist => tests/phpunit/phpunit.xml.dist | 0 3 files changed, 15 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 Makefile rename phpunit.xml.dist => tests/phpunit/phpunit.xml.dist (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5ad4d7d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,12 @@ +name: CI + +on: [push] + +jobs: + build-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: php-actions/composer@v1 + - uses: php-actions/phpunit@v1 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2b163f2 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +.PHONY: dependencies +dependencies: + composer install \ No newline at end of file diff --git a/phpunit.xml.dist b/tests/phpunit/phpunit.xml.dist similarity index 100% rename from phpunit.xml.dist rename to tests/phpunit/phpunit.xml.dist From 63eace42937c14563f594ff2fbd970d5b798d3ce Mon Sep 17 00:00:00 2001 From: neveldo Date: Fri, 24 Jul 2020 17:59:53 +0200 Subject: [PATCH 02/12] init ci.yml --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ad4d7d..8e27e69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - name: start running unit tests + run: Start running unit tests + - uses: actions/checkout@v2 - uses: php-actions/composer@v1 - uses: php-actions/phpunit@v1 \ No newline at end of file From ec711e2a7806313afe3a7ef312463460fd047c96 Mon Sep 17 00:00:00 2001 From: neveldo Date: Fri, 24 Jul 2020 18:08:34 +0200 Subject: [PATCH 03/12] init ci.yml --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e27e69..734f77b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: start running unit tests - run: Start running unit tests - uses: actions/checkout@v2 - uses: php-actions/composer@v1 - uses: php-actions/phpunit@v1 \ No newline at end of file From 66d82bd253ae6db921bfbcd33557b0e3f27b04f8 Mon Sep 17 00:00:00 2001 From: neveldo Date: Fri, 24 Jul 2020 18:26:50 +0200 Subject: [PATCH 04/12] Fix phpunit configuration --- .github/workflows/ci.yml | 5 ++++- tests/phpunit/phpunit.xml.dist => phpunit.xml | 0 2 files changed, 4 insertions(+), 1 deletion(-) rename tests/phpunit/phpunit.xml.dist => phpunit.xml (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 734f77b..cd7745c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,4 +9,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: php-actions/composer@v1 - - uses: php-actions/phpunit@v1 \ No newline at end of file + - name: PHPUnit tests + uses: php-actions/phpunit@v1 + with: + config: phpunit.xml \ No newline at end of file diff --git a/tests/phpunit/phpunit.xml.dist b/phpunit.xml similarity index 100% rename from tests/phpunit/phpunit.xml.dist rename to phpunit.xml From 0ee89e00c47225d7af73bdcd5e61610c8d6943da Mon Sep 17 00:00:00 2001 From: neveldo Date: Fri, 24 Jul 2020 18:35:04 +0200 Subject: [PATCH 05/12] fix test --- composer.json | 2 +- tests/TextGenerator/TextGeneratorTest.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 62c47f3..0c300e2 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "library", "license": "MIT", "require": { - "php": ">=5.5.0", + "php": "^9.0", "symfony/expression-language": "^3.0|^4.0" }, "require-dev": { diff --git a/tests/TextGenerator/TextGeneratorTest.php b/tests/TextGenerator/TextGeneratorTest.php index ce83b52..e3ec41e 100644 --- a/tests/TextGenerator/TextGeneratorTest.php +++ b/tests/TextGenerator/TextGeneratorTest.php @@ -2,8 +2,6 @@ namespace Neveldo\TextGenerator; -echo "hihihihih"; - class TextGeneratorTest extends \PHPUnit\Framework\TestCase { public function setUp() { From 6cfad345403ac12ae9e2116900728e4908e245ac Mon Sep 17 00:00:00 2001 From: neveldo Date: Fri, 24 Jul 2020 18:44:24 +0200 Subject: [PATCH 06/12] Fix phpunit version --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 0c300e2..fb753c5 100644 --- a/composer.json +++ b/composer.json @@ -4,11 +4,11 @@ "type": "library", "license": "MIT", "require": { - "php": "^9.0", + "php": "^7.3", "symfony/expression-language": "^3.0|^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4" : { From 890c15666255f335eab29b21b156d6f0a90d9278 Mon Sep 17 00:00:00 2001 From: neveldo Date: Fri, 24 Jul 2020 18:49:25 +0200 Subject: [PATCH 07/12] fix phpunit tests typehint --- tests/TextGenerator/TextFunction/ChooseFunctionTest.php | 2 +- tests/TextGenerator/TextFunction/CoalesceFunctionTest.php | 2 +- tests/TextGenerator/TextFunction/ExprFunctionTest.php | 2 +- tests/TextGenerator/TextFunction/FilterFunctionTest.php | 2 +- tests/TextGenerator/TextFunction/IfFunctionTest.php | 2 +- tests/TextGenerator/TextFunction/LoopFunctionTest.php | 2 +- .../TextFunction/ProbabilityRandomFunctionTest.php | 2 +- tests/TextGenerator/TextFunction/RandomFunctionTest.php | 2 +- tests/TextGenerator/TextFunction/SetFunctionTest.php | 2 +- tests/TextGenerator/TextFunction/ShuffleFunctionTest.php | 2 +- tests/TextGenerator/TextGeneratorTest.php | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/TextGenerator/TextFunction/ChooseFunctionTest.php b/tests/TextGenerator/TextFunction/ChooseFunctionTest.php index 5d46788..5a30e30 100644 --- a/tests/TextGenerator/TextFunction/ChooseFunctionTest.php +++ b/tests/TextGenerator/TextFunction/ChooseFunctionTest.php @@ -6,7 +6,7 @@ class ChooseFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->tagReplacer = new TagReplacer(); $this->function = new ChooseFunction($this->tagReplacer); } diff --git a/tests/TextGenerator/TextFunction/CoalesceFunctionTest.php b/tests/TextGenerator/TextFunction/CoalesceFunctionTest.php index 78c9b92..b08d1ff 100644 --- a/tests/TextGenerator/TextFunction/CoalesceFunctionTest.php +++ b/tests/TextGenerator/TextFunction/CoalesceFunctionTest.php @@ -6,7 +6,7 @@ class CoalesceFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->tagReplacer = new TagReplacer(); $this->function = new CoalesceFunction($this->tagReplacer); } diff --git a/tests/TextGenerator/TextFunction/ExprFunctionTest.php b/tests/TextGenerator/TextFunction/ExprFunctionTest.php index e4e0250..b310c38 100644 --- a/tests/TextGenerator/TextFunction/ExprFunctionTest.php +++ b/tests/TextGenerator/TextFunction/ExprFunctionTest.php @@ -6,7 +6,7 @@ class ExprFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->tagReplacer = new TagReplacer(); $this->function = new ExprFunction($this->tagReplacer); } diff --git a/tests/TextGenerator/TextFunction/FilterFunctionTest.php b/tests/TextGenerator/TextFunction/FilterFunctionTest.php index a5f64af..7d8d670 100644 --- a/tests/TextGenerator/TextFunction/FilterFunctionTest.php +++ b/tests/TextGenerator/TextFunction/FilterFunctionTest.php @@ -6,7 +6,7 @@ class FilterFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->tagReplacer = new TagReplacer(); $this->function = new FilterFunction($this->tagReplacer); } diff --git a/tests/TextGenerator/TextFunction/IfFunctionTest.php b/tests/TextGenerator/TextFunction/IfFunctionTest.php index b5ad9d1..1ccbc14 100644 --- a/tests/TextGenerator/TextFunction/IfFunctionTest.php +++ b/tests/TextGenerator/TextFunction/IfFunctionTest.php @@ -6,7 +6,7 @@ class IfFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->tagReplacer = new TagReplacer(); $this->function = new IfFunction($this->tagReplacer); } diff --git a/tests/TextGenerator/TextFunction/LoopFunctionTest.php b/tests/TextGenerator/TextFunction/LoopFunctionTest.php index 474cba5..98ad6ac 100644 --- a/tests/TextGenerator/TextFunction/LoopFunctionTest.php +++ b/tests/TextGenerator/TextFunction/LoopFunctionTest.php @@ -6,7 +6,7 @@ class LoopFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->tagReplacer = new TagReplacer(); $this->function = new LoopFunction($this->tagReplacer); $this->oneElementTag = [ diff --git a/tests/TextGenerator/TextFunction/ProbabilityRandomFunctionTest.php b/tests/TextGenerator/TextFunction/ProbabilityRandomFunctionTest.php index 1a07a29..0ed9203 100644 --- a/tests/TextGenerator/TextFunction/ProbabilityRandomFunctionTest.php +++ b/tests/TextGenerator/TextFunction/ProbabilityRandomFunctionTest.php @@ -6,7 +6,7 @@ class ProbabilityRandomFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->tagReplacer = new TagReplacer(); $this->function = new ProbabilityRandomFunction($this->tagReplacer); } diff --git a/tests/TextGenerator/TextFunction/RandomFunctionTest.php b/tests/TextGenerator/TextFunction/RandomFunctionTest.php index 995d12f..43d6e4f 100644 --- a/tests/TextGenerator/TextFunction/RandomFunctionTest.php +++ b/tests/TextGenerator/TextFunction/RandomFunctionTest.php @@ -6,7 +6,7 @@ class RandomFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->tagReplacer = new TagReplacer(); $this->function = new RandomFunction($this->tagReplacer); } diff --git a/tests/TextGenerator/TextFunction/SetFunctionTest.php b/tests/TextGenerator/TextFunction/SetFunctionTest.php index 7ca6a6c..dc3e0fc 100644 --- a/tests/TextGenerator/TextFunction/SetFunctionTest.php +++ b/tests/TextGenerator/TextFunction/SetFunctionTest.php @@ -4,7 +4,7 @@ class SetFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->textGenerator = new TextGenerator(); } diff --git a/tests/TextGenerator/TextFunction/ShuffleFunctionTest.php b/tests/TextGenerator/TextFunction/ShuffleFunctionTest.php index d11263f..913192e 100644 --- a/tests/TextGenerator/TextFunction/ShuffleFunctionTest.php +++ b/tests/TextGenerator/TextFunction/ShuffleFunctionTest.php @@ -6,7 +6,7 @@ class ShuffleFunctionTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->tagReplacer = new TagReplacer(); $this->function = new ShuffleFunction($this->tagReplacer); } diff --git a/tests/TextGenerator/TextGeneratorTest.php b/tests/TextGenerator/TextGeneratorTest.php index e3ec41e..1469db9 100644 --- a/tests/TextGenerator/TextGeneratorTest.php +++ b/tests/TextGenerator/TextGeneratorTest.php @@ -4,7 +4,7 @@ class TextGeneratorTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->textGenerator = new TextGenerator(); } From d0d806c1d30e785287d7cad9d052b11ddde15725 Mon Sep 17 00:00:00 2001 From: neveldo Date: Sun, 26 Jul 2020 23:30:36 +0000 Subject: [PATCH 08/12] update ci conf --- .github/workflows/ci.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd7745c..e623b41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,8 +8,25 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: php-actions/composer@v1 - - name: PHPUnit tests - uses: php-actions/phpunit@v1 - with: - config: phpunit.xml \ No newline at end of file + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + coverage: "none" + extensions: "json" + ini-values: "memory_limit=-1" + php-version: 7.4 + - name: Determine composer cache directory + id: composer-cache + run: echo "::set-output name=directory::$(composer config cache-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.directory }} + key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ matrix.php }}-composer- + - name: Install dependencies + run: | + composer install --no-progress --no-suggest --ansi + - name: Run tests + run: ./vendor/phpunit/phpunit \ No newline at end of file From 36be34956475fd80cd0b0dac969f4128cd9a4666 Mon Sep 17 00:00:00 2001 From: neveldo Date: Sun, 26 Jul 2020 23:39:50 +0000 Subject: [PATCH 09/12] update ci conf --- .github/workflows/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e623b41..412af33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,15 +18,15 @@ jobs: - name: Determine composer cache directory id: composer-cache run: echo "::set-output name=directory::$(composer config cache-dir)" - - - name: Cache composer dependencies - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.directory }} - key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ matrix.php }}-composer- - - name: Install dependencies - run: | - composer install --no-progress --no-suggest --ansi + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- - name: Run tests run: ./vendor/phpunit/phpunit \ No newline at end of file From e00cadb365f774731fee3872564136b14c2cdb24 Mon Sep 17 00:00:00 2001 From: neveldo Date: Sun, 26 Jul 2020 23:41:49 +0000 Subject: [PATCH 10/12] update ci conf --- .github/workflows/ci.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 412af33..d7244af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,16 +8,13 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - coverage: "none" - extensions: "json" - ini-values: "memory_limit=-1" - php-version: 7.4 - - name: Determine composer cache directory - id: composer-cache - run: echo "::set-output name=directory::$(composer config cache-dir)" + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + coverage: "none" + extensions: "json" + ini-values: "memory_limit=-1" + php-version: 7.4 - name: Get Composer Cache Directory id: composer-cache run: | From 095047c79096dcbb91f224138c8d13a7b924c4cf Mon Sep 17 00:00:00 2001 From: neveldo Date: Sun, 26 Jul 2020 23:44:44 +0000 Subject: [PATCH 11/12] update ci conf --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7244af..4881436 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,5 +25,8 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-composer- + - name: Install dependencies + run: | + composer install --no-progress --no-suggest --ansi - name: Run tests - run: ./vendor/phpunit/phpunit \ No newline at end of file + run: ./vendor/phpunit/phpunit/phpunit \ No newline at end of file From 444f7e492c890d7a2d98d5cd0547d3e43deac97c Mon Sep 17 00:00:00 2001 From: neveldo Date: Sun, 26 Jul 2020 23:47:21 +0000 Subject: [PATCH 12/12] update ci conf --- tests/TextGenerator/Tag/TagReplacerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TextGenerator/Tag/TagReplacerTest.php b/tests/TextGenerator/Tag/TagReplacerTest.php index 1d76bd4..ea2cc48 100644 --- a/tests/TextGenerator/Tag/TagReplacerTest.php +++ b/tests/TextGenerator/Tag/TagReplacerTest.php @@ -9,7 +9,7 @@ public function testSetTags() $tr = new TagReplacer(); $tr->setTags(['tag1' => 'val1', 'tag2' => 'val2']); $this->assertEquals(['tag1' => 'val1', 'tag2' => 'val2'], $tr->getTags()); - $this->assertEquals(['@tag1' => 'val1', '@tag2' => 'val2'], $tr->getEscapedTags()); + $this->assertEquals(['@tag1' => 'val1ERROR', '@tag2' => 'val2'], $tr->getEscapedTags()); } public function testSetTagsWithArrayTag()