diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4881436 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI + +on: [push] + +jobs: + build-test: + runs-on: ubuntu-latest + + 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: 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: Install dependencies + run: | + composer install --no-progress --no-suggest --ansi + - name: Run tests + run: ./vendor/phpunit/phpunit/phpunit \ 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/composer.json b/composer.json index 62c47f3..fb753c5 100644 --- a/composer.json +++ b/composer.json @@ -4,11 +4,11 @@ "type": "library", "license": "MIT", "require": { - "php": ">=5.5.0", + "php": "^7.3", "symfony/expression-language": "^3.0|^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4" : { diff --git a/phpunit.xml.dist b/phpunit.xml similarity index 100% rename from phpunit.xml.dist rename to phpunit.xml 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() 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 ce83b52..1469db9 100644 --- a/tests/TextGenerator/TextGeneratorTest.php +++ b/tests/TextGenerator/TextGeneratorTest.php @@ -2,11 +2,9 @@ namespace Neveldo\TextGenerator; -echo "hihihihih"; - class TextGeneratorTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + public function setup(): void { $this->textGenerator = new TextGenerator(); }