Closed DiscipleOfShinku closed 4 years ago
@DiscipleOfShinku You are using 2 years old version of Codeception and Yii2 module is the most actively developed module, so it changed a long in 2 years.
Please upgrade to Codeception 4.0 or at least to 3.1.2 and try again.
@Naktibalda, I've removed codeception/base and installed Codeception 4.0 and necessary modules. However, now each time I run tests all tables in the test database are dropped.
ERROR 1146 (42S02) at line 11: Table 'db_test.admin' doesn't exist In DbPopulator.php line 108:
I have to do migrate/up after that.
each time I run tests all tables in the test database are dropped.
It turns out that I misunderstood how cleanup
option works.
Thanks!
OK, I've finally found it. The reason was connected to how include
works in PHP.
$db = require __DIR__ . '/test_db.php';
$db2 = require __DIR__ . '/test_db_2.php';
test_db_2.php
$db['dsn'] = 'mysql:host=localhost;dbname=db_2_test';
What are you trying to achieve?
To test an Yii2 application with two databases.
What do you get instead?
With one database tests work as expected:
test.php
Output
Two databases:
test.php
Output
Config files: test_db.php
db.php
test_db_2.php
db_2.php
Details
composer show
) behat/gherkin v4.4.5 Gherkin DSL parser for PHP 5.3 bower-asset/bootstrap v3.4.1 bower-asset/inputmask 3.3.11 bower-asset/jquery 3.4.1bower-asset/punycode v1.3.2 bower-asset/yii2-pjax 2.0.7.1 cebe/markdown 1.2.1 A super fast, highly extensible markdown parser for PHP codeception/base 2.3.9 BDD-style testing framework codeception/specify 0.4.6 BDD code blocks for PHPUnit and Codeception codeception/stub 1.0.4 Flexible Stub wrapper for PHPUnit's Mock Builder codeception/verify 0.4.0 BDD assertion library for PHPUnit doctrine/instantiator 1.3.0 A small, lightweight utility to instantiate objects in PHP without invoking their constructors doctrine/lexer 1.2.0 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. egulias/email-validator 2.1.11 A library for validating emails against several RFCs ezyang/htmlpurifier v4.12.0 Standards compliant HTML filter written in PHP fortawesome/font-awesome 5.12.0 The iconic font, CSS, and SVG framework froala/wysiwyg-editor v2.9.5 A beautiful jQuery WYSIWYG HTML rich text editor. High performance and modern design make it easy to use for developers a... froala/yii2-froala-editor 2.9.5 A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performan... fzaninotto/faker v1.9.0 Faker is a PHP library that generates fake data for you. guzzlehttp/psr7 1.6.1 PSR-7 message implementation that also provides common utility methods myclabs/deep-copy 1.9.3 Create deep copies (clones) of your objects opis/closure 3.5.1 A library that can be used to serialize closures (anonymous functions) and arbitrary objects. phar-io/manifest 1.0.1 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 1.0.1 Library for handling version information and constraints phpdocumentor/reflection-common 2.0.0 Common reflection classes used by phpdocumentor to reflect the code structure phpdocumentor/reflection-docblock 4.3.2 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that i... phpdocumentor/type-resolver 1.0.1 A PSR-5 based resolver of Class names, Types and Structural Element Names phpspec/php-diff v1.1.0 A comprehensive library for generating differences between two hashable objects (strings or arrays). phpspec/prophecy 1.9.0 Highly opinionated mocking framework for PHP 5.3+ phpunit/php-code-coverage 5.3.2 Library that provides collection, processing, and rendering functionality for PHP code coverage information. phpunit/php-file-iterator 1.4.5 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-text-template 1.2.1 Simple template engine. phpunit/php-timer 1.0.9 Utility class for timing phpunit/php-token-stream 2.0.2 Wrapper around PHP's tokenizer extension. phpunit/phpunit 6.5.14 The PHP Unit Testing framework. phpunit/phpunit-mock-objects 5.0.10 Mock Object library for PHPUnit psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11) psr/http-message 1.0.1 Common interface for HTTP messages ralouphie/getallheaders 3.0.3 A polyfill for getallheaders. rmrevin/yii2-fontawesome 3.4.0 Asset Bundle for Yii2 with Font Awesome sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code belongs to sebastian/comparator 2.1.3 Provides the functionality to compare PHP values for equality sebastian/diff 2.0.1 Diff implementation sebastian/environment 3.1.0 Provides functionality to handle HHVM/PHP environments sebastian/exporter 3.1.2 Provides the functionality to export PHP variables for visualization sebastian/global-state 2.0.0 Snapshotting of global state sebastian/object-enumerator 3.0.3 Traverses array structures and object graphs to enumerate all referenced objects sebastian/object-reflector 1.1.1 Allows reflection of object attributes, including inherited and non-public ones sebastian/recursion-context 3.0.0 Provides functionality to recursively process PHP variables sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on resources sebastian/version 2.0.1 Library that helps with managing the version number of Git-hosted PHP projects swiftmailer/swiftmailer v6.2.3 Swiftmailer, free feature-rich PHP mailer symfony/browser-kit v4.2.4 Symfony BrowserKit Component symfony/console v4.4.1 Symfony Console Component symfony/css-selector v4.4.1 Symfony CssSelector Component symfony/dom-crawler v4.4.1 Symfony DomCrawler Component symfony/event-dispatcher v4.4.1 Symfony EventDispatcher Component symfony/event-dispatcher-contracts v1.1.7 Generic abstractions related to dispatching event symfony/finder v4.4.1 Symfony Finder Component symfony/polyfill-ctype v1.13.1 Symfony polyfill for ctype functions symfony/polyfill-iconv v1.13.1 Symfony polyfill for the Iconv extension symfony/polyfill-intl-idn v1.13.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-mbstring v1.13.1 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 v1.13.1 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-php73 v1.13.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions symfony/service-contracts v2.0.1 Generic abstractions related to writing services symfony/yaml v4.4.1 Symfony Yaml Component theseer/tokenizer 1.1.3 A small library for converting tokenized PHP source code into XML and potentially other formats webmozart/assert 1.6.0 Assertions to validate method input/output with nice error messages. yiisoft/yii2 2.0.30 Yii PHP Framework Version 2 yiisoft/yii2-bootstrap 2.0.10 The Twitter Bootstrap extension for the Yii framework yiisoft/yii2-composer 2.0.8 The composer plugin for Yii extension installer yiisoft/yii2-debug 2.1.12 The debugger extension for the Yii framework yiisoft/yii2-faker 2.0.4 Fixture generator. The Faker integration for the Yii framework. yiisoft/yii2-gii 2.1.3 The Gii extension for the Yii framework yiisoft/yii2-swiftmailer 2.1.2 The SwiftMailer integration for the Yii framework