codeception

Using parameter placeholders in codeception.yml

浪尽此生 提交于 2019-12-03 15:07:05
I'm setting up Codeception's Db module and would like to use the parameters from my Symfony 2's parameters.yml file. Basically something like this: paths: tests: tests log: tests/_log data: tests/_data helpers: tests/_helpers settings: bootstrap: _bootstrap.php suite_class: \PHPUnit_Framework_TestSuite colors: true memory_limit: 1024M log: true modules: config: Symfony2: app_path: 'app' var_path: 'app' environment: 'test' Db: dsn: "mysql:host='%test_database_host%';dbname='%test_database_name%'" user: "%test_database_user%" password: "%test_database_password%" dump: tests/_data/test_data.sql

Codeception & Symfony - run Doctrine migrations before tests

余生长醉 提交于 2019-12-03 12:54:14
I have a Symfony 4 application and Doctrine with Doctrine migrations. I'm introducing Codeception for running API tests, and need to run migrations before the tests run. Since I'm using the Doctrine2 module I don't really want to be also including the DB module as it's not needed for the tests and would require configuring the test database in two different locations. I am using the Symfony module currently, and I noticed that the Laravel module has a run_database_migrations configuration option. What is the best way to handle running the Doctrine migrations command in a Symfony app prior to

Vagrant, Codeception & Laravel issue. NotFoundHttpException

断了今生、忘了曾经 提交于 2019-12-02 10:32:52
I'm trying to get into using codeception for my acceptance testing. I have the following for one of my tests: <?php use Codeception\Util\Stub; class SomeTest extends \Codeception\TestCase\Test { protected $webGuy; /** * @test */ public function incorrect_login_should_redirect_back() { $I = $this->webGuy; $I->wantTo('fail at logging in'); $I->amOnPage('/'); // <-- This is the line that is failing $I->fillField('email','info@tntstudio.hr'); $I->fillField('password','pass'); $I->click('Login'); $I->see('email', 'input'); $I->seeCurrentUrlEquals('/login'); } } Initially the tests ran OK, however

Codeception acceptance tests within database transaction on MySQL

人盡茶涼 提交于 2019-12-02 10:30:10
问题 Writing acceptance tests using Codeception for our Custom (with Symfony components and Doctrine) framework. We have a set of utility methods, used separately by our Phpunit tests, for creating various entities to test against. This includes things such as users, and other related data. In the case of our Codeception tests we want to make use of this functionality, allowing us to seed custom data and clean it up afterwards. In the context of our Unit tests this is handled by a transaction.

Laravel 5.1 Eloquent isFillable() discrepancy in unit tests

霸气de小男生 提交于 2019-12-02 08:33:49
问题 Is there a reason why Eloquent ignores the fillable settings for a model when used in a unit test? In a non test situation, I get the following output, which is correct, since the model only allows certain fillable fields: $m = new Model(); dd($m->isFillable('nonexistent_field')); --> false But if I do the same thing in a unit test: $m = new Model(); dd($m->isFillable('nonexistent_field')); --> true This is breaking all of my tests. How can I force Eloquent to respect the fillable rules I set

Laravel 5.1 Eloquent isFillable() discrepancy in unit tests

会有一股神秘感。 提交于 2019-12-02 05:10:45
Is there a reason why Eloquent ignores the fillable settings for a model when used in a unit test? In a non test situation, I get the following output, which is correct, since the model only allows certain fillable fields: $m = new Model(); dd($m->isFillable('nonexistent_field')); --> false But if I do the same thing in a unit test: $m = new Model(); dd($m->isFillable('nonexistent_field')); --> true This is breaking all of my tests. How can I force Eloquent to respect the fillable rules I set for it so the unit tests actually match reality? I was running into this as well. Apparently Laravel

Use of undefined constant SIGTERM - > assumed 'SIGTERM'

烈酒焚心 提交于 2019-12-01 22:13:16
Currently running PHPUnit with Codeception on my Windows machine gives me an error: [PHPUnit_Framework_Exception] Use of undefined constant SIGTERM - assumed 'SIGTERM' As far as I know is that SIGTERM is a constant provided by PCNTL , which is not supported in Windows. In that way this CONSTANT shouldnt be used for a test running on Windows env. at all. My PHP setup: PHP 5.6.17 (cli) (built: Jan 6 2016 13:28:38) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies PHPUnit PHPUnit 5.7.15 Codeception Codeception PHP Testing Framework v2.2.9

Is it possible to store Functional/Acceptance config URL of Codeception outside repository?

大憨熊 提交于 2019-12-01 22:13:00
I have a PHP project with Codeception on which several developers are working. Everyone have their own environment and different URL to their copy of the project. But in Codeception Functional/Acceptance yml config file we have to set up URL for acceptance and functional tests. How could we have different URL to project and have main part of configs in repository? Thank you in advance. One way to solve this is to look at the $_SERVER['HOSTNAME'] value and select the appropriate url from that. I've currently got this in my tests/acceptance/_bootstrap.php switch($_SERVER['HOSTNAME']) { case

Codeception seeInDatabase() doesn't work for me

故事扮演 提交于 2019-12-01 07:54:14
问题 I am really stuck with this acceptance test. My code is this $I->click('Submit'); $I->see('Client Added'); $I->seeInDatabase('customers',[ 'afm'=>'111' ]); Everything passes until the line with "seeInDatabase". Log gives me this error "ALERT: No matching records found Failed asserting that '0' is greater than 0.". I checked the database settings modules: config: Db: dsn: 'mysql:host=localhost;dbname=dbtesting' user: 'test' password: 'test' dump: app/tests/_data/dump.sql populate: true cleanup

Will Selenium work on Ubuntu with no GUI [duplicate]

给你一囗甜甜゛ 提交于 2019-11-30 18:57:52
问题 This question already has answers here : Is it possible to run selenium (Firefox) web driver without a GUI? (10 answers) Closed 3 years ago . I'm using Codeception on various cloud platforms like Amazon AWS and Cloud 9. Neither of which has a GUI by default. My question is, can you run Selenium on this type of system? Or do I need to somehow get a GUI? 回答1: Selenium is only a library, and as such it does not particularly care if you are running it on a system that is equipped with a GUI. What