# YiiBridge **Repository Path**: mirrors_glendemon/YiiBridge ## Basic Information - **Project Name**: YiiBridge - **Description**: Wrapper classes required to run Yii functional tests with Codeception - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Codeception <=> Yii Bridge ========= Wrapper classes required to run Yii functional tests with Codeception. Does not provide a smooth integration (yet). For now use for your own pain and risk. ### Concept Yii1 framework was not designed for functional testing. This bridge classes include components that override standart Yii components to be testable. The most common issues with Yii functional tests are usage `headers`, `cookies` functions in PHP code, which produce errors on testing. Also usage of `exit` directive might even stop test execution completely. ### Install * Install [Codeception](http://codeception.com/install) via composer ``` php composer.phar require "codeception/codeception:*" php composer.phar update ``` * Bootstrap Codeception to ```protected/tests``` ``` ./vendor/bin/codecept bootstrap protected/tests ``` * And set up [Yii1](http://codeception.com/docs/modules/Yii1) module. __test.php__: ```php 'CWebApplication', 'config' => $config, ); ``` __codeception.yml__: ``` actor: Dev paths: tests: protected/tests log: protected/tests/_log data: protected/tests/_data helpers: protected/tests/_helpers settings: bootstrap: _bootstrap.php colors: true memory_limit: 1024M log: true debug: true modules: enabled: [PhpBrowser, WebHelper, TestHelper, Yii1] config: PhpBrowser: url: http://localhost:8234 Yii1: appPath: test.php url: http://localhost:8234/test.php ``` * Install YiiBridge via Composer ``` php composer.phar require "codeception/YiiBridge:*" php composer.phar update ``` * Modify your ```protected/config/test.php``` configuration file to use the ```CodeceptionHttpRequest``` class instead of ```CHttpRequest``` ```php array( [...] 'request' => array( 'class' => 'CodeceptionHttpRequest' ), [...] ), ); ``` * Done! Use codeception normally to generate at run tests ### Important Notes This bridge is far from complete. It might not suit your project as well. So any contributions are welcome. If you feel like you need to customize any of provided classes - please do that. ### Known Issues and Roadmap * Sessions -> triggers php error * Forwards -> triggers php error * CLocale -> triggers error * Http Codes * WebApplication->end -> triggers `exit` directive ### Credits Initial version created by [**Ragazzo**](https://github.com/Ragazzo).