From 660ebb41df50638b42d6c1ffb2983620a87b9b7d Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Fri, 22 Nov 2019 21:02:47 +0200 Subject: [PATCH] Upgrade to Codeception 4.0 (#218) * Use modular Codeception 4.0 * Moved bootstrap setting to top level Because old location is deprecated See https://bit.ly/2YrRzVc * Use stringContainsString instead of contains Because using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. * Removed 5.4 and 5.5 --- .travis.yml | 4 ---- codeception.yml | 2 +- composer.json | 10 ++++++---- tests/unit/models/ContactFormTest.php | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa4b850..4583c1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,10 +8,6 @@ matrix: - php: "7.1" - php: "7.0" - php: "5.6" - - php: "5.5" - dist: trusty - - php: "5.4" - dist: trusty # faster builds on new travis setup not using sudo sudo: false diff --git a/codeception.yml b/codeception.yml index a95affe..d5aecb3 100644 --- a/codeception.yml +++ b/codeception.yml @@ -1,11 +1,11 @@ actor: Tester +bootstrap: _bootstrap.php paths: tests: tests log: tests/_output data: tests/_data helpers: tests/_support settings: - bootstrap: _bootstrap.php memory_limit: 1024M colors: true modules: diff --git a/composer.json b/composer.json index 8ffc76d..324bd02 100644 --- a/composer.json +++ b/composer.json @@ -23,11 +23,13 @@ "yiisoft/yii2-debug": "~2.1.0", "yiisoft/yii2-gii": "~2.1.0", "yiisoft/yii2-faker": "~2.0.0", - - "codeception/base": "~2.3.0", - "codeception/verify": "~0.4.0", + "codeception/codeception": "4.0.x-dev | ^4.0", + "codeception/verify": "~0.5.0 || ~1.1.0", "codeception/specify": "~0.4.6", - "symfony/browser-kit": ">=2.7 <=4.2.4" + "symfony/browser-kit": ">=2.7 <=4.2.4", + "codeception/module-filesystem": "^1.0.0", + "codeception/module-yii2": "^1.0.0", + "codeception/module-asserts": "^1.0.0" }, "config": { "process-timeout": 1800, diff --git a/tests/unit/models/ContactFormTest.php b/tests/unit/models/ContactFormTest.php index 031d2bd..0744487 100644 --- a/tests/unit/models/ContactFormTest.php +++ b/tests/unit/models/ContactFormTest.php @@ -43,6 +43,6 @@ class ContactFormTest extends \Codeception\Test\Unit expect($emailMessage->getFrom())->hasKey('noreply@example.com'); expect($emailMessage->getReplyTo())->hasKey('tester@example.com'); expect($emailMessage->getSubject())->equals('very important letter subject'); - expect($emailMessage->toString())->contains('body of current message'); + expect($emailMessage->toString())->stringContainsString('body of current message'); } }