Questions tagged [Codeception] (119)

1
answer

Report acceptance tests in Yii 2, shows 0 code coverage. How to set up?

At the command codecept run --coverage --coverage-html Report for unit and functional tests displayed normally, but any acceptance test shows OK (2 tests, 4 assertions) Code Coverage Report: 2020-04-07 14:21:22 Summary: Classes: 0.00% (0/34) Methods: 0.00% (0/177) Lines: 0.00% (0/3656) Why is this happening, ho...
Bryon_Skiles23 asked April 18th 20 at 12:25
0
answer

How to use getModule in Codeception?

In a class of helper functions to create a new user, I want to use the methods of module installed "Db": public function createUser() { // Add client /** * @var $dbm Db */ $dbm = $this->getModule('Db'); $dbm->_getDbh(); $dbm->haveInDatabase('site_users', [ 'name' => $this->customerName, 'solution' =>...
brian.Koe asked April 8th 20 at 17:49
1
answer

Codeception in your own helper to connect to the 2nd database?

Write your helper in which I want to implement functionality for subsequent call tests. In the late fiege codeception.yml: paths: tests: tests output: tests/_output data: tests/_data support: tests/_support envs: tests/_envs actor_suffix: Tester extensions: enabled: - Codeception\Extension\RunFailed modules: enabled: ...
Reinhold.Dietrich94 asked April 8th 20 at 17:40
0
answer

Why doesn't disabling csrf_protection through the config in Symfony?

For acceptance tests, you should disable csrf protection at the site level (not through the container, as this can be done in the unit tests). The official documentation says it can be done So, indicate in codeception.yml: params: - .env.test.local In .env.test.local: APP_ENV=test In config/packages/test/framework.yaml...
pierce_OK asked April 8th 20 at 03:01
1
answer

How to fix error element not interactable?

Use Chrome Driver (Yii2 framework), run the following command D:\ChromeDriver\chromedriver.exe --url-base=/wd/hub Acceptance.suite.yml class_name: AcceptanceTester modules: enabled: - WebDriver: url: http://arctic/ window_size: false # disabled in non-ie web browsers port: 9515 browser: chrome - Yii2: part: orm entr...
Monica.OHara asked April 7th 20 at 11:31
0
answer

How to specify .env.test and .env.test.local at the same time?

I think everyone knows the system load configuration, when it is enough to specify .env, and the system will check the availability .env.local, and if it is - it will load the local version. In the settings codeception have to specify both: params: - .env.test - .env.test.local Locally everything works, but when running...
connor asked April 7th 20 at 09:31
1
answer

How to throw an exception?

Have an Address class with constructor public function __construct(string $country,string $city, string $street, string $house, string $building = ") {} I want to validate all of the addresses (country, city, street, building, structure). It all possible private function isCountryValid($param) { if (empty($param) || !preg_...
Gregory.Lebsack13 asked April 3rd 20 at 18:53
0
answer

How to fix the behavior sendAjaxPostRequest()?

Hi all. Write functional test under YII2, for "clicking" the button using sendAjaxPostRequest():$I->sendAjaxPostRequest('/some/action', ['id' => $id]); $I->amOnPage('/'); $I->seeElement('body'); In the end, the test crashes:Test tests\functional\my–°est.php:tryToTest See Step element "body" Fail Element located e...
clement_Stracke asked April 3rd 20 at 17:31
3
answers

What literature advise on testing?

Hello. Realized that I don't have a clear, structured understanding of how the tests work, what types of tests are, how they differ (acceptance, functional, unit, etc.). How to spell them. Advise the literature on this topic. Will be a big plus if there are examples, even better, if the examples are to PHPUnit or Codeceptio...
Lisette asked March 31st 20 at 15:16
0
answer

How to log in the methods that are called from tests in Codeception?

All kind time of day! Gash HelloWorld on Yii2. Gash a few custom events. In the method event handlers added logging Yii::info(). If you call trigger() in the controller, then everything works OK: logging in the methods event handlers are working fine. When you call trigger() from a method in the class unit test logging is n...
ian44 asked March 30th 20 at 00:43