PK 1pN
{ { codecept.batnu W+A @echo off
if "%PHP_PEAR_PHP_BIN%" neq "" (
set PHPBIN=%PHP_PEAR_PHP_BIN%
) else set PHPBIN=php
"%PHPBIN%" "codecept" %*
PK 1pNT<
W ISSUE_TEMPLATE.mdnu W+A #### What are you trying to achieve?
#### What do you get instead?
> Provide console output if related. Use `-vvv` mode for more details.
```bash
# paste output here
```
> Provide test source code if related
```php
// paste test
```
### Details
* Codeception version:
* PHP Version:
* Operating System:
* Installation type: Phar || Composer
* List of installed packages (`composer show`)
* Suite configuration:
```yml
# paste suite config here
```
PK 1pN- - CHANGELOG-2.5.mdnu W+A #### 2.5.5
* [Laravel] Fix missing declaration shouldReport in Laravel 5.8 by @edno
* [Lumen] add support for Laravel\Lumen\Application::boot by @lendormi
* [WebDriver] Fixed SetCookie for chromedriver 2.46+ by @JorisVanEijden
* [ZendExpressive] Fixed recreateApplicationBetweenRequests option, by @artmnv
* [Gherkin] Add possibility to dynamically load contexts (#5409) by @hansdubois
* [Build command] Fixed message printing number of methods in actor class
* Documented usage of IS NULL in Doctrine module by @ThomasLandauer
#### 2.5.4
* Restored compatibility with vlucas/phpdotenv v2
* [Doctrine] Fixed cleanup issue #5326
#### 2.5.3
* [Db] cleanup database if populator is used
* [FTP] Compatibility with phpseclib v2 by @kardagan
* [JsonType] Fixed issue #5230 Dropped filters after a string:regex by @ellisgl
* [Symfony] Fixed persistent service functionality for Symfony 3 by @Naktibalda
* [ZendExpressive] Set Cookie header in request by @Naktibalda
* Updated vlucas/phpdotenv package to ^3.0 version by @KartaviK
* Documentation improvements by @chrisaligent @richleland @SanzhiyevMergen @sdlins
#### 2.5.2
* [ZendExppressive] Support for Zend Expressive v3 by @Naktibalda
* [ZendExppressive] Added options to reload application between tests and between requests by @Naktibalda
* [Symfony] Fix "already initialized service", "reboot kernel issue" #5262 by @gdmfx
* {Yii2] Prevent NPE #5259 by @SilverFire
* [Db] isPopulated method was hidden by renaming to _isPopulated by @Naktibalda
* [Db] don't clear database for empty dump by @Slamdunk
* [AMQP] added methods `seeQueueIsEmpty`, `dontSeeQueueIsEmpty`, `seeNumberOfMessagesInQueue`, `scheduleQueueCleanup` method by @kardagan
* [REST][PhpBrowser][Frameworks] Save page source as .fail.json or .fail.xml depending on content type, by @freiondrej
* [Doctrine2] Cleanup property works after on reconfigure #5250 by @joelmedeiros
* [JsonType] Allow to use : in regex filter (#5273) by @ellisgl
* [WebDriver] Print curl error to debug output if WebDriver failed to connect #5315 by @Naktibalda
* [Logger] Ignores empty context and extra fields, by @siad007
* [Recorder] Improved steps ignoring in Recorder extension with meta steps and annotations support #5210 by @sspat.
* `@dataProvider` works with yield/generators #5271 by @burned42
* Fixed issue ArrayContainsComparator do not Intersect correctly Empty expected nested array #5303 by @malinink
* Fixed issue of steps with mocked objects #5163 by @dh9325
* Added Environment Name To Descriptor Unique Signatures #5294 by @Tenzian
* Run command: Added `--phpunit-xml` option, which produces xml report having the same structure as PhpUnit's #5004 by @Naktibalda
* Bootstrap command: Changed namespace shortcut to `-s` #5275 by @Naktibalda
* Improved the docs; by @h311ion, @gimler, @picass0, @josephzidell
#### 2.5.1
* Recorder extension improvements by @OneEyedSpaceFish. See #5177:
* HTML layout improvements
* Restructured tests to show nested output
* file operation exceptions / log them without throwing exceptions
* fix edge cases with file operations (too long wantTo, etc.)
* the ability to automatically purge old reports (from previous runs)
* display errors in the recorded page rather than saving it as error.png
* the ability not to display any Unicode characters if ANSI only output is requested
* the ability not to display any colors in output if no-colors is requested
* the ability to change colors in the generated list based on configuration
* [Db] Made `_loadDump` unconditional like it was in 2.4. Fixed #5195 by @Naktibalda
* [Db] Allows to specify more than one dump file. See #5220 by @Fenikkusu
* [WebDriver] Added `waitForElementClickable` by @FatBoyXPC
* Code coverage: added `work_dir` config option to map remote paths to local. See #5225 by @Fenikkusu
* [Lumen] Added Lumen 5.5+ support for getRoutes method by @lendormi
* [Yii2] Restored `getApplication()` API by @Slamdunk
* [Yii2] Added deprecation doc to `getApplication()` by @Slamdunks
* [Doctrine2] Reloading module on reconfigure to persist new configs. See #5241 by @joelmedeiros
* [Doctrine2] Rollback all nested transactions created within test by @Dukecz
* [DataFactory] Reloading module on reconfigure to persist new configs. See #5241 by @joelmedeiros
* [Phalcon] Allows null content in response. By @Fenikkusu
* [Phalcon] Added `session` config option to override session class. By @Fenikkusu
* [Asserts] Added `expectThrowable()` method by @burned42
* Use `*.yaml` for params loading
#### 2.5.0
* [**Snapshot testing**](https://codeception.com/docs/09-Data#Testing-Dynamic-Data-with-Snapshots) introduced. Test dynamic data sets by comparing current values with previously saved ones.
* [Db] **Multi database support**. See #4857 by @eXorus
* `amConnectedToDatabase` method added.
* `performInDatabase` method added.
* Rerun tests in **[shuffle mode](https://codeception.com/docs/07-AdvancedUsage#Shuffle)** in the same order by setting seed value. By @SamMousa
* [PhpBrowser][Frameworks] **Breaking Change** `seeLink` now matches the end of a URL, instead of partial matching. By @Slamdunk
* Previous: `$I->seeLink('Delete','/post/1');` matches `Delete`
* Now: `$I->seeLink('Delete','/post/1');` does NOT match `Delete`
* [WebDriver] Keep coverage cookies in `loadSessionSnapshot`. Fix by @rajras
* [Yii2] Prevent null pointer exception by @SilverFire. See #5136
* [Yii2] Fixed issue with empty response stream by @SamMousa.
* [Yii2] Fixed `Too many connections` issue #4926. By @roslov
* [Yii2] Fixed #4769: `amLoggedInAs()` throws TypeError. By @SamMousa
* [Recorder Extension] Fixing recorder extension issues caused by phpunit 7.2.7 update by @OneEyedSpaceFish
* [Logger Extension] Added `codecept_log` function to write to logs from any place. Fixes #3551 by @siad007
* [WebDriver] Report correct strict locator in error message. When `see()` and `dontSee()` are used with array selector. Fix by @Naktibalda.
* [Phalcon] Use bind for find record. See #5158 by @Joilson
* [Phalcon] Add support for nullable fields in `findRecord()` by @arjanwestdorp
* Added `memory_limit` to `dry-run` command by @siad007. Fixes #5090
* Added ext-curl to the composer require section by @siad007
* Make `coverage: show_only_summary` configurable. See #5142 by @Quexer69
* Ensure php extension `mbstring` is available by @siad007. Fixes #4575
PK 1pN1m
PruneTest.phpnu W+A '/.*Yii2.*/',
'Lumen' => '/.*(Lumen|LaravelCommon).*/',
'Laravel' => '/.*Laravel.*/',
'Phalcon' => '/.*Phalcon.*/',
'Symfony' => '/.*Symfony.*/',
'Yii1' => '/.*Yii1.*/',
'ZendExpressive' => '/.*ZendExpressive.*/',
'Zend2' => '/.*ZF2.*/',
];
// First check if changes include files that are not framework files.
$frameworkOnly = true;
$frameworks = [];
foreach ($files as $file) {
$match = false;
foreach ($regexes as $framework => $regex) {
if (preg_match($regex, $file)) {
$match = true;
$frameworks[$framework] = $framework;
break;
}
}
if (!$match) {
$frameworkOnly = false;
break;
}
}
if ($frameworkOnly) {
stderr('Changes limited to frameworks: ' . implode(', ', $frameworks));
if (!isset($frameworks[$currentFramework])) {
stderr("Skipping test for framework: $currentFramework");
echo "export FRAMEWORK=\n";
echo "export PECL=\n";
echo "export FXP=\n";
echo "export CI_USER_TOKEN=\n";
}
}
PK 1pNS
4
4 CHANGELOG-2.3.mdnu W+A #### 2.3.9
* Added `Codeception\Step\Argument\PasswordArgument` to pass sensitive data into tests:
```php
amOnPage('/form/password_argument');
$I->fillField('password', new PasswordArgument('thisissecret'));
```
* [WebDriver] added `clearField` method to clean up input fields by @eknej
* [DataFactory] added `make` method to create instances without saving them to database. But @ibpavlov
* [REST] Fixed passing a file to `sendPOST()` without name, size or type parameter. BY @zebraf1
* [REST] Add missing / to relative url from config by @bscheshirwork
* Fixed HTML Report marks tests as succeeded by @mpgo13
* `clean` command works recursively with included setups. By @davidnewcomb
#### 2.3.8
* `Codeception\Util\Stub` moved to standalone package [Codeception\Stub](https://github.com/Codeception/Stub):
* Use `Codeception\Stub` instead of `Codeception\Util\Stub`
* Mocking methods `::once`, `::never`, etc moved to `Codeception\Stub\Expected` class
* Calling mocking methods from `Codeception\Util\Stub` provides deprecation warning.
* Non-static API is [recommended to use for mocking](http://codeception.com/docs/05-UnitTests)
* [WebDriver] Added `executeAsyncJS` action to run asynchronous scripts.
* [WebDriver] Added second parameter to `executeJS` to pass additional arguments into JavaScript function.
* [Yii2] `setCookie` signs cookies when signing enabled. #4656 By @SamMousa
* [Yii2] Method `createAndSetCsrfCookie` added. #4656 By @SamMousa
* Compatibility with phpunit-mock-objects 5.* by @Naktibalda
* [DataFactory] Removed dependency to `league/factory-muffin-faker` by @Naktibalda and @Insolita
* Fixed auto-rebuilding Actor classes when dependencies are used. See #4694 by @stefankleff.
* [Symfony] allows to use Symfony Dotenv component to parse `.env` files. Fix by @ebuildy
* Added the ability to export the code coverage data in PHPUnit xml format by @tobiasstadler
* `--coverage-phpunit` option added
* Allows to use mutation testing with [Inflection](https://infection.github.io)
* [ZendExpressive] Added Doctrine2 integration by @artmnv
* [PhpBrowser][Frameworks] Added `_getResponseStatusCode` hidden method for using in helpers. By @FanchTheSystem
* [Yii2] Use Yii DI to instantiate record class. Fixes #4762. By @bscheshirwork
* Remote Code Coverage improvements #4768 by @bscheshirwork
* Remove `:port` for cookie domain;
* `->amOnPage('/');` executed when running code coverage with WebDriver
* Fixed running single test with `include` config parameter. Fixes #4733 by @ppetpadriew
* Fixed running single test when a custom suite path is configured (For instance, in single-suite setups).
* `generate:test` command won't include `tester` property if actor is not set for this config.
* [Facebook] Module is not maintained and is deprecated. If you are using it and you want to keep it, please contact us.
#### 2.3.7
* **Symfony 4 support** implemented by @VolCh.
* Dependencies updated to support Symfony 4.x components.
* [Symfony] Support for Symfony Flex directory and namespace structure
* [Demo application](https://github.com/Codeception/symfony-demo) was updated to Symfony 4.0
* [Db] `seeInDatabse`, `dontSeeInDatabase`, `grabFromDatabase` and other methods to support SQL comparison operators: `<`, `>`, `>=`, `<=`, `!=`, `like`. Thanks @susgo and @Naktibalda.
* [Db] Fixed quoting around schema identifiers in MSSQL by @Naktibalda. See #4542.
* [Db] Added SSL options for connection. Thanks @kossi84
* [Db] Fix getting Database name from DSN in MSSQL by @yesdevnull.
* [PhpBrowser] Fixed setting `User-Agent` in config via `headers`. Fixed #4576 by @Naktibalda.
* [WebDriver] Implemented `dontSeeInPopup` by @kpascal.
* [WebDriver] Allow to click a button located by its `title` attribute. See #4586 by @gimler.
* [Silex] `app` property added to public API. Thanks @sky003
* [Yii2] Pass DB to Yii application as early as possible to reuse old connection. By @SilverFire. See #4601
* [Yii2] Resetting global event handlers after a test. See #4621 by @SamMousa
* [Yii2] Recreate request object to reset headers and cookies before each request. Fixes #4587 by @erickskrauch
* [MongoDb] Allowing `.tgz` files to be accepted for database dumps. #4611 by @Lukazar
* [PhpBrowser][Frameworks] Fixed usage of `see` when source code contains `<=` JS operator. By @tobias-kuendig Fixes #4509.
* [Queue] Added configuration parameter `endpoint` for AmazonSQS by @gitis.
* Fixed signature error in `DummyCodeCoverage::stop` See #4665 by @network-spy
* Throw exception if `exit(0)` was accidentally called. Fixes false-positive test reports. See #4604 by Fenikkusu.
* Fixed using `path: tests: .` in configuration. Fixes #4432 by @marcovtwout
* Fixed suite name containing slash in remote code coverage. #4612 by @bscheshirwork
* Improved generated actions file by removing redundant `use` section. #4614 by @bscheshirwork
* Don't skip last test if some test has missing dependency by @Naktibalda. Fixes #4598
* Improved PHP 7.2 compatibility by @FanchTheSystem. See #4557
* Implemented `Descriptor::getTestSignatureUnique` to create unique names for tests. See #4673 by @Tenzian. Fixes #4672
* Fixed `setExpectedException()` default value for PHPUnit 5.7.23 by @MilesChou. See #4566
* Fixed printing wrong failed step by @eXorus. See #4654
* Fixed undefined `argv` warnings, added check for `register_argc_argv`. Fixes #4595 by @Naktibalda
* Added `init` command to `codecept.phar` by @Naktibalda.
And many thanks to our awesome contributors! Thanks to @VolCh for upgrading to Symfony 4, thanks @Naktibalda for patches and reviews and
thanks to @carusogabriel for refactoring tests.
#### 2.3.6
* **Laravel 5.5 compatibility**. Laravel5 module documentation updated.
* [Doctrine2][DataFactory] Fixes using Doctrine2 with DataFactory module. See #4529. Fix by @samusenkoiv
* [REST] Fixed JsonType crash when key 0 is not an array. Fixes #4517 by @Naktibalda
* [PhpBrowser][Frameworks] `haveHttpHeader` enhanced to handle special characters. #4541 by @bnpatel1990
* [WebDriver] Delete all cookies before loading session snapshot. Fix by @eXorus. See #4487
* Added `suite_namespace` config option to suite config. Allows to set custom namespace for tests per suite. #4525 by @pohnean
* [Db] Module enhancements by @eXorus:
* added `updateInDatabase` method
* added hidden `_insertInDatabase` to insert record without cleanup
* [Yii2] Set transaction also in `backupConfig` when initializing yii2 module
* [Yii2] Unload fixtures after rolling back database transaction. By @devonliu02 (#4497)
* [Yii2] Use `andWhere` instead of `where` in Yii module's `findRecord()` by @SamMousa. See #4482
* [REST] Added `amNTLMAuthenticated` for NTLM authentication using PhpBrowser. By @Tenzian
* Inject exception file and line number frame into stack trace in case it is missing. By @rhl-jfm at #4491)
* `Extension\RunFailed`. Added `fail-group` parameter to customize name of a failed group. By @ maxgorovenko
* Added `\Codeception\Util\Fixtures::exists()` method by @eXorus
* Added line number to `TestParseException` exception message by @gaainf. See #4446
* Fixed `init` command: create the `_generated` folder before writing a `.gitignore` file there by @nstapelbroek. See #4449
* Better failure messages for `@dataProvider` by @sh41. See #4439
* Fixed aliasing issue with `Codeception/Verify` by @ddinchev
#### 2.3.5
* Fixed HTML report with unencoded HTML code by @mpgo13. See #3819 #4423
* Made `assertArraySubset` protected across all modules by @guidocella
* [WebDriver][PhpBrowser][Frameworks] Added support for associative arrays in `seeInFormFields` by @guidocella
* [PhpBrowser][Frameworks] Submit default values of checkboxes. See #4411 by @guidocella
* [PhpBrowser][Frameworks] Make `seeInField` check options' texts and trimmed texts. By @guidocella
* [PhpBrowser] Prevents `submitForm` to submit inputs in disabled fieldsets. Fixes #4426 by @moebrowne
* [PhpBrowser] Fixed `amOnUrl` with empty path component. If path component was empty, it used previous url. Fixes #4383 by @Naktibalda
* [Db] Improved postgres cleanup (recreate schema) by @samusenkoiv
* [Laravel5] Don't duplicate associative array fields on form submission. See #4414 by @guidocella
* [WebDriver] Fixed `webDriver->getCapabilities()` for `facebook/php-webdriver` < 1.3 (could happen on PHP 5.4, 5.5). Fixes #4435
* [WebDriver] Make `wait` accept fractional amount of seconds to wait for less than a second. By @gvlasov
* [Laravel5] Changing params loader to use `$_SERVER` global instead of `$_ENV`. See #4401 by @EricTendian
* [Mongo] Fixes `haveInCollection` using `__toString`. See #4442 by @samusenkoiv
* Dereferencing variables for Steps output. Fixes #4402 by @alambe
* [Symfony] Load persistent services before loading profiler. See #4437 by @samusenkoiv
#### 2.3.4
* Added `@prepare` annotation to make realtime configuration for tests in Cest and Test classes. [See documentation](http://codeception.com/docs/06-ModulesAndHelpers#Runtime-Configuration-of-a-Test).
Example: disabling Doctrine2 database transaction for a test
```php
_reconfigure(['cleanup' => false]);
}
```
* [WebDriver] **SmartWait**. Automatically waits for a few extra seconds for element to appear on a page before failing. Can reduce high usage of `wait*` methods. [See Documentation](http://codeception.com/docs/03-AcceptanceTests#SmartWait)
* Added [RunProcess extension](http://codeception.com/extensions#RunProcess). Use it to start/stop Selenium (or other process) automatically for a test suite.
* [WebDriver] Customization improvements:
* added `start` option to disable autostart of a browser for tests. (can be useful for Cloud testing setups)
* added `_capabilities` method for setting desired capabilities in runtime (can be combined with `@prepare` annotation)
* `_initializeSession` and `_closeSession` can be used in Helpers to start and stop browser manually (combine with `start: false` config)
* Fixed running a single test from a global config when using included configs. See #4366 by @zebraf1 (improves PhpStorm integration)
* [Doctrine2][Laravel5][Yii2][Phalcon] Print debug information for started/stopped transactions in tests. See #4352
* [PhpBrowser][Frameworks] click with context respects base tag #4330 by @Naktibalda.
* [Yii2] Split `cleanup` configuration option (backward-compatible): (#4379 by @leandrogehlen)
* `cleanup` - to cleanup loaded fixtures
* `transaction` - wrap tes into transaction
* [Asserts] Added `assertStringStartsWith` and `assertArraySubset` by @guidocella
* [Db] Added `updateInDatabase` method by @eXorus. See #4385
* In helpers and modules to check `$module::$excludeActions` property for existence before accessing it. Fixes #4381 by @CactusCoder
* [Symfony] Fixed printing debug response when `Symfony::extractRawRoles()` failed on security collector (Symfony >= 3.3) #4309 by @Basster
* [Laravel5] Fixed bug with `disable_exception_handling` functionality. See #4370. By @janhenkgerritsen
* [Db] Added `grabColumnFromDatabase` to fetches values from the column in database. By @RebOOter
#### 2.3.3
* Fixed running with `--coverage`, `--xml`, `--html` options without parameters (Symfony Console 3.3 compatibility).
* Removed `files` section from `composer.json` (regression from 2.3.2) to avoid unintentionally loading shim files. Fixes [Yii migration issue](https://github.com/yiisoft/yii2/issues/14226).
* [WebDriver] `saveScreenshot` allows to save screenshots with no name passed in. See #4263 by @eXorus
* [REST][PhpBrowser] Fixed #4287, using empty values for headers by @tobiastom.
* Phar `self-update` downloads php5.4 build if php version <7.0. Fixes #4269
#### 2.3.2
* [Db] Fixed: Database has been cleaned up between tests even with `cleanup: false`.
* [Db] Made `dump` optional if `populator` is set. Fixes #4247
* Fixed `generate:suite` command to create a directory for the suite. Fixes #4251
* Fixed composer autoloading with PHPUnit 6 by @enumag. See #4262
#### 2.3.1
* Updated composer constraints to include PHPUnit 6.x
#### 2.3.0
* **PHPUnit 6.x** support #4142 by @MontealegreLuis. Class aliases are used, so PHPUnit 4.x and 5.x (for PHP <7) are still supported as well.
* Suite customization. [Announcement](/05-22-2017/codeception-2-3.html#configuration-improvements)
* Installation Templates. [Announcement](/05-22-2017/codeception-2-3.html#installation-templates)
* DotReporter introduced. Use it with
```
codecept run --ext DotReporter
```
* `--ext` parameter added to load extensions dynamically.
* Db Populator [Announcement](/05-22-2017/codeception-2-3.html#db-populator) by @brutuscat
* [Db] New configuration defaults, cleanups are disabled: `cleanup: false`, `populate: false`. Enable them to load dumps between tests.
* [Redis] New configuration defaults, cleanups are disabled: `cleanupBefore: 'never'` by @hchonan
* Command `generate:phpunit` removed.
* Bootstrap `_bootstrap.php` files are disabled by default.
* Configuration changes: `actor` replaced with `actor_suffix` in global config
* Configuration changes: `class_name` replaced with `actor` in suite config
PK 1pNHhI CHANGELOG-2.4.mdnu W+A #### 2.4.5
* Fixed PHPUnit 7.2 compatibility.
* Introduced **RunBefore** extension to execute scripts before running tests. See #5049 by @aashmelev.
* [Db] Added two options for MySQL by @bangertz
* `ssl_cipher` - list of one or more permissible ciphers to use for SSL encryption
* `ssl_verify_server_cert` - disables certificate CN verification
* [Db] Always disconnect before connect when `reconnect` is set. By @ashnazg
* [Db] More explicit PDO closing upon destruction and close opened transactions by @ashnazg.
* [Recorder Extension] Improved error logging by @OneEyedSpaceFish. See #5101
* [Lumen] Fixed file uploads via REST module. By @retnek.
* Fixed: function getMetadata() may not exist, results in fatal error. See #4913 by @marcovtwout
#### 2.4.4
* Recently added `extends` property in the `codeception.yml` and `*.suite.yml` files now support absolute paths; by @silverfire
* Fixed absolute paths handling on Windows in ParamLoader; by @silverfire
* [Yii2] Refactored database connection handling by @SamMousa. Database connections should now always be closed after tests no matter how you have opened them or who is holding references to them. See #5045
* [Symfony] Email handling improved by @mbohal. Fixes #5058.
* Added optional argument `$expectedCount` to `seeEmailIsSent`
* Added `dontSeeEmailIsSent`
* [Recorder Extension] Added `ignore_steps` option to disable recording of specific steps. By @sspat.
* [WebDriver] Fixed "No Session Timeout" fatal error by @davertmik.
* [WebDriver] Added ability to locate clickable element by its title. See #5065 by @gimler
* [Db] Add `waitlock` config option for the database session to wait for lock in Oracle. By @ashnazg. See #5069
* [REST] Fixed `seeXmlResponseEquals` by @Voziv
#### 2.4.3
* [Create your own test formats](https://codeception.com/docs/07-AdvancedUsage#Formats) (e.g., Cept, Cest, ...); by @mlambley
* [Symfony] Fixed a bug in order to use multiple Kernels; by @alefcastelo
* [Asserts] Added new methods `assertNotTrue` and `assertNotFalse` methods; by @johannesschobel
* [REST][PhpBrowser][Frameworks] Added new methods to check for `Http Status Ranges` with nice "wrappers" (e.g., `seeHttpStatusCodeIsSuccessful()` checks the code between 200 and 299); by @johannesschobel
* Improved the docs; by community
#### 2.4.2
* Added support for `extends` in the `codeception.yml` and `*.suite.yml` files; by @johannesschobel.
Allows to inherit current config from a provided file. See example for `functional.suite.yml`:
```yml
actor: FunctionalTester
extends: shared.functional.suite.yml
modules:
enabled:
- \App\Modules\X\Tests\Helper\Functional
```
* [Yii2] Restore null check for client in Yii2 by @wkritzinger. See #4940
* [Yii2] Resetting Yii application in `_after`. By @SamMousa. See #4928
* [Yii2] **Breaking** `$settings['configFile']` now supports absolute paths. In you have defined relative path to config in absolute manner
* [WebDriverIO] Added `deleteSessionSnapshot` by @vi4o
* [Symfony] Added support for custom kernel names with `kernel_class` config option. By @omnilight.
* [Asserts] Better exception message for `expectException` by @Slamdunk
* [REST] Decode all non-arrays to array. See #4946 by @Amunak, fixes #4944.
* [ZF2] Fixed compatibility with ZF2 ServiceManager by @omnilight.
* [Laravel5] Fixed memory leak when using Laravel factories inside Codeception. See #4971 by @AdrianSkierniewski
* [Db] Added support for `null` values in MSSQL driver by @philek
* Handle absolute paths in ParamsLoader by @SilverFire
* Fix error on single file test. See #4986 by @mikbox74
* Upgraded to Codeception/Stub 2.0 by @Naktibalda, fixed compatibility.
#### 2.4.1
* Fixed "Uncaught Error: Call to undefined method Codeception\Test\Descriptor::getTestDataSetIndex()" error when filtering tests.
* Better support of PHPUnit warning status by @edno:
* support PHPUnit addWarning()
* display 'W' instead of success for warning test cases
* Fixed Running test with invalid dataprovider by @okneloper. Fixed #4888 by @edno
* [Yii2] **Request flow and database transactions refactored** (by @sammousa):
* **Breaking** Application is no longer available in helpers via `$this->getModule('Yii2'')->app`, now you must use `\Yii::$app` everywhere
* Multiple databases are now supported
* More reliable application state before and during test execution
* Fixtures method is now configurable
* Subset of misconfigurations are now detected and informative messages created
* Fixed using `$settings['path']` in `Codeception\Configuration::suiteSettings()` on Windows by @olegpro
(starting with `/`), you must change it. @silverfire
* [Laravel5] Added Laravel 5.4+ (5.1+ backward compatible) support for `callArtisan` method in Laravel5 module. See #4860 by @mohamed-aiman
* Fixed #4854: unnecessary escaping in operation arguments logging by @nicholascus
* Fixed humanizing steps for utf8 strings by @nicholascus. See #4850
* Fixed parsing relative urls in `parse_url`. See #4853 by @quantum-x
#### 2.4.0
* **PHPUnit 7.x compatibility**
* **Dropped PHP 5.4 and PHP 5.5** support (PHP 5.5 still may work)
* Internal API refactored:
* Modern PHP class names used internally
* Moved PHPUnit related classes to [codeception/phpunit-wrapper](https://github.com/Codeception/phpunit-wrapper) package.
* Removed `shims` for underscore PHPUnit classes > namespaced PHP classes
* Cest hooks behavior changed (by @fffilimonov):
* `_failed` called when test fails
* `_passed` called when tests is successful
* `_after` is called for failing and successful tests
**Upgrade Notice**: If you face issues with underscore PHPUnit class names (like PHPUnit_Framework_Assert) you have two options:
* Lock version for PHPUnit in composer.json: "phpunit/phpunit":"^5.0.0"
* Update your codebase and replace underscore PHPUnit class names to namespaced (PHPUnit 6+ API)
PK 1pN
z z .travis.ymlnu W+A language: php
matrix:
fast_finish: true
php:
- 5.6
- 7.0
- 7.1
- 7.2
env:
global:
- XDEBUG=
- SUITES=
- FXP=
- PECL=
- TEST_PATH='framework-tests'
- SYMFONY_DEPRECATIONS_HELPER=weak
matrix:
- FRAMEWORK=Codeception SUITES=cli,unit TEST_PATH=. XDEBUG=1 PECL=mongodb
- FRAMEWORK=Yii2 TEST_REPO="https://github.com/Codeception/yii2-tests"
- FRAMEWORK=Symfony VERSION=2.8 TEST_REPO='-b 2.1 https://github.com/Codeception/symfony-demo.git' SUITES=functional TEST_PATH=framework-tests/src/AppBundle
- FRAMEWORK=Symfony VERSION=3.4 TEST_REPO='--recurse-submodules https://github.com/Naktibalda/codeception-symfony-tests'
- FRAMEWORK=Symfony VERSION=4 TEST_REPO='https://github.com/Codeception/symfony-demo.git' SUITES=functional,unit
- FRAMEWORK=Lumen TEST_REPO='-b codeception-2.2 https://github.com/codeception/codeception-lumen-sample.git'
- FRAMEWORK=Laravel TEST_REPO='-b codeception-2.6 https://github.com/codeception/codeception-laravel5-sample.git'
- FRAMEWORK=Phalcon TEST_REPO=https://github.com/Codeception/phalcon-demo.git
- FRAMEWORK=Zend2 TEST_REPO='-b 2.2 --recurse-submodules https://github.com/Naktibalda/codeception-zf2-tests' SUITES=functional
- FRAMEWORK=ZendExpressive TEST_REPO='-b 2.2 --recurse-submodules https://github.com/Naktibalda/codeception-zend-expressive-tests' SUITES=functional
matrix:
include:
- php: 7.1
env: FRAMEWORK=Codeception SUITES=cli,unit,coverage TEST_PATH=. XDEBUG=1 PECL=mongodb
exclude:
- php: 7.1
env: FRAMEWORK=Codeception SUITES=cli,unit TEST_PATH=. XDEBUG=1 PECL=mongodb
- php: 7.0
env: FRAMEWORK=Symfony VERSION=2.8 TEST_REPO='-b 2.1 https://github.com/Codeception/symfony-demo.git' SUITES=functional TEST_PATH=framework-tests/src/AppBundle
- php: 7.1
env: FRAMEWORK=Symfony VERSION=2.8 TEST_REPO='-b 2.1 https://github.com/Codeception/symfony-demo.git' SUITES=functional TEST_PATH=framework-tests/src/AppBundle
- php: 7.2
env: FRAMEWORK=Symfony VERSION=2.8 TEST_REPO='-b 2.1 https://github.com/Codeception/symfony-demo.git' SUITES=functional TEST_PATH=framework-tests/src/AppBundle
- php: 5.6
env: FRAMEWORK=Symfony VERSION=3.4 TEST_REPO='--recurse-submodules https://github.com/Naktibalda/codeception-symfony-tests'
- php: 7.0
env: FRAMEWORK=Symfony VERSION=3.4 TEST_REPO='--recurse-submodules https://github.com/Naktibalda/codeception-symfony-tests'
- php: 5.6
env: FRAMEWORK=Symfony VERSION=4 TEST_REPO='https://github.com/Codeception/symfony-demo.git' SUITES=functional,unit
- php: 7.0
env: FRAMEWORK=Symfony VERSION=4 TEST_REPO='https://github.com/Codeception/symfony-demo.git' SUITES=functional,unit
- php: 7.2
env: FRAMEWORK=Yii2 TEST_REPO="https://github.com/Codeception/yii2-tests"
addons:
postgresql: "9.2"
branches:
except:
- gh-pages
cache:
directories:
- vendor
- $HOME/.composer/cache
services:
- mongodb
- rabbitmq
- postgresql
- redis
before_install:
- '$(php PruneTest.php)'
- '[[ !(-z "$XDEBUG") ]] || phpenv config-rm xdebug.ini'
- export INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- echo memory_limit = -1 >> $INI
install:
- '[[ -z "$CI_USER_TOKEN" ]] || composer config github-oauth.github.com ${CI_USER_TOKEN};'
# Add extensions
- '[[ -z "$PECL" ]] || (yes "" | pecl install -f $PECL)'
# Clone test repository
- '[[ "$FRAMEWORK" == "Codeception" ]] || git clone -q --depth=1 $TEST_REPO framework-tests'
- '[[ "$FRAMEWORK" == "Codeception" ]] || git --git-dir framework-tests/.git log -n 1'
- '[[ "$FRAMEWORK" != "Codeception" ]] || composer require mongodb/mongodb --no-update'
- '[[ -z "$FXP" ]] || composer global require "fxp/composer-asset-plugin:~1.3.1"'
- '[[ "$FRAMEWORK" != "Symfony" ]] || composer require symfony/finder=~$VERSION --no-update --ignore-platform-reqs'
- '[[ "$FRAMEWORK" != "Symfony" ]] || composer require symfony/yaml=~$VERSION --no-update --ignore-platform-reqs'
- '[[ "$FRAMEWORK" != "Symfony" ]] || composer require symfony/console=~$VERSION --no-update --ignore-platform-reqs'
- '[[ "$FRAMEWORK" != "Symfony" ]] || composer require symfony/event-dispatcher=~$VERSION --no-update --ignore-platform-reqs'
- '[[ "$FRAMEWORK" != "Symfony" ]] || composer require symfony/css-selector=~$VERSION --no-update --ignore-platform-reqs'
- '[[ "$FRAMEWORK" != "Symfony" ]] || composer require symfony/dom-crawler=~$VERSION --no-update --ignore-platform-reqs'
- '[[ "$FRAMEWORK" != "Symfony" ]] || composer require symfony/browser-kit=~$VERSION --no-update --ignore-platform-reqs'
- '[[ "$FRAMEWORK" != "Symfony" ]] || composer require symfony/browser-kit=~$VERSION --no-update --ignore-platform-reqs'
# Phalcon
- '[[ "$FRAMEWORK" != "Phalcon" ]] || git clone -q --depth=1 https://github.com/phalcon/cphalcon.git -b v3.4.2'
- '[[ "$FRAMEWORK" != "Phalcon" ]] || (cd cphalcon/build; bash ./install --phpize $(phpenv which phpize) --php-config $(phpenv which php-config) &>/dev/null && phpenv config-add ../tests/_ci/phalcon.ini &> /dev/null)'
# Symfony
#- '[[ "$FRAMEWORK$VERSION" != "Symfony3" ]] || composer require -d framework-tests symfony/symfony=~$VERSION --no-update'
- '[[ -z "$FRAMEWORK" ]] || composer install'
- '[[ "$FRAMEWORK" == "Codeception" ]] || [[ -z "$FRAMEWORK" ]] || composer update -d framework-tests --no-dev --prefer-dist'
before_script:
- '[[ "$TRAVIS_PHP_VERSION" == 7.* ]] || echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini'
# preparing databases
- '[[ "$FRAMEWORK" != "Codeception" ]] || mysql -e "create database codeception_test;"'
- '[[ "$FRAMEWORK" != "Codeception" ]] || psql -c "create database codeception_test;" -U postgres'
- '[[ "$FRAMEWORK" != "Symfony" ]] || mysql -e "create database symfony_test;"'
# starting demo servers
- '[[ "$FRAMEWORK" != "Codeception" ]] || php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 &'
- '[[ "$FRAMEWORK" != "Codeception" ]] || php -S 127.0.0.1:8010 -t tests/data >/dev/null 2>&1 &'
# Phalcon
- '[[ "$FRAMEWORK" != "Phalcon" ]] || mysql -e "CREATE DATABASE phalcon_demo CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"'
- '[[ "$FRAMEWORK" != "Phalcon" ]] || cat framework-tests/schemas/phalcon_demo.sql | mysql phalcon_demo'
# Laravel 5
- '[[ "$FRAMEWORK" != "Laravel" ]] || touch framework-tests/storage/testing.sqlite'
- '[[ "$FRAMEWORK" != "Laravel" ]] || php framework-tests/artisan migrate --env=testing --database=sqlite_testing --force'
# Lumen
- '[[ "$FRAMEWORK" != "Lumen" ]] || cp framework-tests/.env.testing framework-tests/.env'
- '[[ "$FRAMEWORK" != "Lumen" ]] || touch framework-tests/storage/testing.sqlite'
- '[[ "$FRAMEWORK" != "Lumen" ]] || php framework-tests/artisan migrate --database=testing --force'
# Symfony
- '[[ "$FRAMEWORK$VERSION" != "Symfony2.8" ]] || php framework-tests/app/console doctrine:schema:create -n --env test'
- '[[ "$FRAMEWORK$VERSION" != "Symfony2.8" ]] || php framework-tests/app/console doctrine:fixtures:load -n --env test'
- '[[ "$FRAMEWORK$VERSION" != "Symfony3.4" ]] || php framework-tests/bin/console doctrine:schema:update --force -n'
# ZF2
- '[[ "$FRAMEWORK" != "Zend2" ]] || mysql -e "create database zf2_test;"'
- '[[ "$FRAMEWORK" != "Zend2" ]] || php framework-tests/vendor/bin/doctrine-module orm:schema-tool:create'
# Build
- '[[ -z "$FRAMEWORK" ]] || php codecept build -c $TEST_PATH'
script:
# Run tests if $FRAMEWORK is not empty
- '[[ -z "$FRAMEWORK" ]] || php codecept run $SUITES -c $TEST_PATH'
PK 1pN^m ruleset.xmlnu W+A
Codeception coding standard. Inherits from PSR-2.
PK 1pN-KT T CHANGELOG-2.1.mdnu W+A #### 2.1.11
* [Yii1] Improved Yii connector. AR metadata is cleaned up between requests. `regenerateId` of session is disabled.
* [REST][InnerBrowser] redirect is not triggered when Location header is set but response code is not 3xx. By @Naktibalda. Fixes #3171.
* [PhpBrowser][Frameworks] checkboxes can be located by label by @dizzy7. See #3237
* [PhpBrowser][Frameworks] field can be matched by its trimmed label value. See #3209. By @dizzy7
* [WebDriver] fixed URL matching in WebDriver::seeLink
* [WebDriver][InnerBrowser] Improved error messages of `seeLink` and `dontSeeLink`
#### 2.1.10
* PHPUnit version locked to <5.4
* [Db] Added missing support for LIKE condition to SqlSrv driver
#### 2.1.9
* PHPUnit 5.4 compatibility for creating mocks using `Codeception\Util\Stub` by @davertmik. See #3093 and #3080
* Updated dependencies to support Symfony 3.1
* [Laravel5] Fixed issue where non-existing services were called in _before and _after methods. See #3028.
* Fix self-update command to update only to stable versions by @MAXakaWIZARD
* Added `settings: backup_global` to config, to disable backup_global option of PHPUnit by @mkeasling. See #3045. Fixes #3044
* [PhpBrowser][Frameworks] `see` matches UTF-8 text case-insensitively by @Naktibalda. Fixes #3114
* Fixed page object generation with namespaces by @eugene-manuilov and @Naktibalda. See #3126 Fixes #3012
* `--steps` will not disable code coverage. By @Naktibalda. Fixes #2620
* Suppress console coverage report with `--quiet` by @EspadaV8. See #2370
* Improved multibyte output in console by @kt81. See #3130
* [Lumen] Fixed: `initializeLumen()` method has been called twice on start by @kt81. See #3124 #2607
* [Db] Allow INT Parameter SQL Binding by @davidcochrum . Fixes #3118
* [Db] Support LIKE conditions in assertions.
* [Db] Improved regex for parsing comments by @dima-stefantsov. See #3138
* [Dbh] Fix `seeInDatabase` and `dontSeeInDatabase` with empty criteria. Closes #3116
* [Symfony] Improve fail messages on seeInCurrentRoute and seeCurrentRouteIs
* [Symfony] Improve route comparison on seeInCurrentRoute and seeCurrentRouteIs
* [WebDriver] multi session testing with friends improved by @eXorus. Webdriver sessions are finished correctly; `leave()` method added to Friend class. See #3068
* [PhpBrowser] added `handler` and `middleware` config options to customize Guzzle handlers and middleware
* Added full support of phpunit-bridge features.
* [Laravel] Fixed issue where non-existing services were called in _before and _after methods. See #3028.
* [WebDriver] fixed using `saveSessionSnapshot` with codecoverage. Closes #2923
* [ZF2] create new instance of Application for each request
#### 2.1.8
* `Util\Locator` added methods to create locators to match element at their position: `elementAt`, `firstElement`, `lastElement`
* [Symfony] Refactor to unify service retrieval, avoid memleaks and reduce memory footprint. Closes #2938 and #2954.
* [Symfony] New optoin `rebootable_client` that reboots client's kernel before each request.
* [WebDriver] fixed `seeInField` for textarea with whitespaces before and after string. Closes #2921
* [Symfony] Deprecated `grabServiceFromContainer` use `grabService` instead. For consistency with other frameworks.
* [Asserts] More `assert*` methods from PHPUnit added
* [Asserts] Added `expectException` method
* `codecept self-update` works with proxy by @gr1ev0us
* [Phalcon1 add params support for method amOnRoute by @MelnykDmitro
#### 2.1.7
* **PHPUnit 5.x support**
* Global Bootstrap, Suite Bootstrap, Module Initialization happens before test loading. Fixes issues of autoloading TestCase classes introduced in 2.1.5, see #2872
* Added option to skip PHP files validation in `codeception.yml` - `settings: lint: false`
* [Facebook] Updated to facebook/php-sdk-v4 version 5 by @orhan-swe and @tigerseo #2828 #2415
* [WebDriver] Added `scrollTo` action by @javigomez and @davertmik #2844
* Fix encoding problems in PHP prior to 5.6 by @pejaycz. See #2831
* [Queue] Fixed `clearQueue` for AmazonSQS by @mikitu #2805
* [Db] Fixed loading files in Sqlite @mcustiel See #2812
* [PhpBrowser] `amHttpAuthenticated` allows null, null as parameters to unset authentication. #2896
* `Util\Locator` added `contains` method to easily locate any element containing a text.
* [Laravel5] Added `guard` parameters to `seeAuthentication` and `dontSeeAuthentication` methods. By @janhenkgerritsen. See #2876
* [Laravel5] Added functionality to disable/enable Laravel's exception handling. By @janhenkgerritsen. See #2763
* [Laravel5] Authentication now persists between requests when calling `amLoggedAs` with an instance of `Authenticable`. See #2795
* [REST] Fixed dontSeeXmlResponseMatchesXpath method #2825 by @mangust404
* [ZF2] Fixed POST parameters #2814 by @Naktibalda
* [ZF1] Call Zend_Registry::_unsetInstance in _after #2863 by @Naktibalda
#### 2.1.6
* Starting from 2.1.6 you can **download PHP 5.4 compatible phar build** at http://codeception.com/php54/codecept.phar by @Naktibalda. See [installation guide](http://codeception.com/install).
* [WebDriver] Fixed uploading files with **PhantomJS** #1823 by @DavertMik and @Naktibalda. Please specify your browser name as `phantom` in WebDriver config in order to use PhantomJS-specific hooks.
* Fixed parsing PHP files with spaces in name on PHP<7 by @acuthbert. Fixes #2647
* [WebDriver] Fixed proxy error when using with Chrome #2651 by @vaikla
* [Laravel5] Allow Laravel5 application URL to be set through config. By @gmhenderson. See #2676
* [Laravel5] Mocked events should also return an array. Fix by @devinfd
* Fixed using codecoverage with environments #2634
* Various HHVM improvements by @Naktibalda, for instance, Asserts module issues has been fixed.
* [REST] Fixes #2775 `seeResponseJsonMatchesXpath` when JSON contains ampersand. By @Naktibalda.
* [Filesystem] Added `seeNumberNewLines` method to check the number of new lines in opened file. By @sergeyklay
* [Symfony2] Added `seeCurrentRouteMatches` action by @laszlo-karpati See #2665
* [Sequence] Added `sqs` function to generate unique sequences per suite. #2766 by @johnatannvmd
* [FTP] Fixed various bugs by @k-serenade. See #2755
* [Frameworks][PhpBrowser] Fixed #2733: `seeOptionIsSelected` sees first option as selected if none is selected by @Naktibalda
* [Symfony2] Removed 'localhost' from getInternalDomains by @Naktibalda. Fixed #2717
* Bugfix for using groups by directory on Windows by @tortuetorche See #2550 and #2551
* [REST] Fixed failed message for `seeHttpHeader` and `dontSeeHttpHeader` from null to expected value #2697 by @zondor
* [REST] Added methods to control redirect: `stopFollowingRedirects` and `startFollowingRedirects` by @brutuscat
* [Recorder Extension] Added `animate_slides` config to disable left-right sliding animation between screenshots by @vml-rmott
#### 2.1.5
* **PHP7 support**
* **Symfony3 support**
* [ZendExpressive] **module added** by @Naktibalda
* [Frameworks] **Internal Domains**: Framework modules now throw an `ExternalUrlException` when a test tries to open a URL that is not handled by the framework, i.e. an external URL. See #2396
* Syntax check for tests. If PHP7 is used, `ParseException` handles syntax error, otherwise linting happens with `php -l`. @davertmik
* Fixed Cest generation to not include "use" statements if no namespaces set
* [REST] Modified JsonArray::sequentialArrayIntersect to return complete matches only by @Naktibalda. Fixes #2635
* [REST] Fixes validation of several types with filters. See #2581 By @davertmik
* [REST] JsonType improved URL filter to use `filter_var($value, FILTER_VALIDATE_URL)`
* [REST] JsonType to support collections: all items in an array will be validates against JsonType. By @davertmik
* [REST] Various fixes to JsonType: #2555 #2548 #2542
* [REST] Hides binary request data in debug by @codemedic. Fixed #1884, See #2552
* [WebDriver] Allow `appendField` to work with content editable div by @nsanden #2588
* [WebDriver] Allows adding ssl proxy settings by @mjntan35.
* [Symfony2] Config option `cache_router` added (disabled by default) by @raistlin.
* [Doctrine] Fixed #2060: Too many connections error by @dranzd
* [Symfony2] `services` part added to allow access Symfony DIC while wokring with WebDriver or PhpBrowser by @laszlo-karpati See #2629
* [WebDriver][PhpBrowser] Unified setCookie "expires" param name by @davertmik. See #2582
* [Memcache] add adaptive close call on `_after` by @pfz. See #2572
* [Symfony2] Move kernel booting and container set up into _initialize() method by @Franua #2491
* [WebDriver] Fixed `seeInField` for textareas by @nsanden
* [Yii2][REST] Fixed using Yii2 as dependency for REST by @Naktibalda. See #2562
* [Laravel5] Removed `enableMiddleware` and `enableEvents` methods. See #2602. By @janhenkgerritsen
* [Laravel] Refactored modules. See #2602. By @janhenkgerritsen
* [Laravel5] Fix bug for `seeCurrentRouteIs` when routes don't match. See #2593. By @maddhatter
* [PhpBrowser] Set curl options for Guzzle6 correctly. See #2533. By @Naktibalda
* Fixed usage of GroupObject by unit tests. GroupObjects can skip tests by @davetmik. See #2617
#### 2.1.4
* [PhpBrowser][Frameworks] Added `_getResponseContent` hidden method. By @Naktibalda
* [PhpBrowser][Frameworks] Added `moveBack` method. By @Naktibalda
* [WebDriver][PhpBrowser][Frameworks] Added `seeInSource`, `dontSeeInSource` methods to check raw HTML instead of stripped text in `see`/`dontSee`. By @zbateson in #2465
* [WebDriver] print Selenium WebDriver logs on failure or manually with `debugWebDriverLogs` in debug mode. Config option `debug_log_entries` added. See #2471 By @MasonM and @DavertMik.
* [ZF2] grabs service from container without reinitializing it. Fixes #2519 where Doctrine2 gets different instances of the entity manager everytime grabServiceFromContainer is called. By @dranzd
* [REST] fixed usage of JsonArray and `json_last_error_msg` function on PHP 5.4. See #2535. By @Naktibalda
* [REST] `seeResponseIsJsonType` can now validate emails with `string:email` definition. By @DavertMik
* [REST] `seeResponseIsJsonType`: `string|null` as well as `null|string` can be used to match null type. #2522 #2500 By @vslovik
* [REST] REST methods can be used to inspect result of the last request made by PhpBrowser or framework module. see #2507. By @Naktibalda
* [Silex] Doctrine provider added. Doctrine2 module can be connected to Silex app with `depends: Silex` in config. By @arduanov #2503
* [Laravel5] Removed `expectEvents` and added `seeEventTriggered` and `dontSeeEventTriggered`. By @janhenkgerritsen
* [Laravel5] Fixed fatal error in `seeCurrentRouteIs` and `seeCurrentActionIs` methods. See #2517. By @janhenkgerritsen
* [Laravel5] Improved the error messages for several methods. See #2476. By @janhenkgerritsen
* [Laravel5] Improved form error methods. See #2432. By @janhenkgerritsen
* [Laravel5] Added wrapper methods for Laravel 5 model factories. See #2442. By @janhenkgerritsen
* [Phalcon] Added `amOnRoute` and `seeCurrentRouteIs` methods by @sergeyklay
* [Phalcon] Added `seeSessionHasValues` by @sergeyklay
* [Phalcon] Added `getApplication()` method by @sergeyklay
* [Symfony2] Sets `xdebug.max_nesting_level` to 200 only if it is lower. Fixes error hiding #2462 by @mhightower
* [Db] Save the search path when importing Postgres dumps #2441 by @EspadaV8
* [Yii2] Fixed problems with transaction rollbacks when using the `cleanup` flag. See #2488. By @ivokund
* [Yii2] Clean up previously uploaded files between tests by @tibee
* Actor classes generation improved by @codemedic #2453
* Added support for nested helper by @luka-zitnik #2494
* Make `generate:suite` respect bootstrap setting in #2512. By @dmitrivereshchagin
#### 2.1.3
* [REST] **Added matching data types** by with new methods `seeResponseMatchesJsonType` and `dontSeeResponseMatchesJsonType`. See #2391
* [PhpBrowser][Frameworks] added `_request` and `_loadPage` hidden API methods for performing arbitrary requests.
* [PhpBrowser][Frameworks] Fixed `seeInField`, `dontSeeInField` for disabled fields #2378. See #2414.
* Environment files can now be located in subfolders of `tests/_env` by @Zifius
* [Symfony2] Fixed issue when accessing profiler when no request has been performed #652.
* [Symfony2] Added `amOnRoute` and `seeCurrentRouteIs` methods by @raistlin
* [ZF2] Added `amOnRoute` and `seeCurrentRouteIs` methods module, by @Naktibalda
* Fixed issue with trailing slashes in `seeCurrentUrlEquals` and `dontSeeCurrentUrlEquals` methods #2324. By @janhenkgerritsen
* Warning is displayed once using unconfigured environment.
* Fixed loading environment configurations for Cept files by @splinter89
* Fixed bootstrap with namespaces to inject namespaced actor classes properly.
* [PhpBrowser][Frameworks] added hidden `_request()` method to send requests to backend from Helper classes.
* [Laravel5] Added `disableEvents()`, `enableEvents()` and `expectEvents()` methods. By @janhenkgerritsen
* [Laravel5] Added `dontSeeFormErrors()` method. By @janhenkgerritsen
* [Db] Deleted Oracle driver (it existed by mistake, the real driver is Oci). By @Naktibalda
* [Db] Implemented getPrimaryKey method for Sqlite, Mysql, Postgresql, Oracle and MsSql. By @Naktibalda
* [Db] Implemented support for composite primary keys and tables without primary keys. By @Naktibalda
* Fixed the scalarizeArray to be aware of NULL fields #2264. By @fbidu
* [Soap] Fixed SOAP module #2296. By @relaxart
* Fixed a bug where blank lines in a groups file would run every test in the project #2297. By @imjoehaines
* [WebDriver] seeNumberOfElements should only count visible elements #2303. By @sascha-egerer
* [PhpBrowser][Frameworks] Verbose output for all HTTP requests. By @Naktibalda
* [PhpBrowser][Frameworks] Throw `Codeception\Exception\ExternalUrlException` when framework module tries to open an external URL #2328. By @Naktibalda
* [PhpBrowser][Frameworks] Added `switchToIframe` method. By @Naktibalda
* [Dbh] module deprecated
#### 2.1.2
* **Updated to PHPUnit 4.8**
* Enhancement: **Wildcard includes enabled when testing [multiple applications](http://codeception.com/docs/08-Customization#One-Runner-for-Multiple-Applications)**. See #2016 By @nzod
* [Symfony2] fixed Doctrine2 integration: Doctrine transactions will start before each test and rollback afterwards. *2015-08-08*
* [Doctrine2] establishing connection and starting transaction is moved to `_before`. *2015-08-08*
* [PhpBrowser] Removed disabled and file fields from form values. By @Naktibalda *2015-08-08*
* [ZF2] Added grabServiceFromContainer function. By InVeX *2015-08-08*
* [PhpBrowser][Guzzle6] Disabled strict mode of CookieJar #2234 By @Naktibalda *2015-08-04*
* [Laravel5] Added `disableMiddleware()` and `enableMiddleware()` methods. By @janhenkgerritsen *2015-08-07*
* Enhancement: If a specific *ActorActions trait does not exist in `tests/_support/_generated` directory, it will be created automatically before run.
* Enhancement: do not execute all included suites if you run one specific suite *2015-08-08*
* `Extension\Recorder` navigate over slides with left and right arrow keys, do not create screenshots for comment steps.
* `Extension\Recorder` generates index html for all saved records.
* `Extension\Recorder` fixed for creating directories twice. Fixed #2216
* `Extension\Logger` fixed #2216
* Fixed injection of Helpers into Cest and Test files. See #2222
* `Stub::makeEmpty` on interfaces works again by @Naktibalda
* Command `generate:scenarios` fixed for Cest files by @mkudenko See #1962
* [Db] Quoted table name in Db::select, removed identical methods from child classes by @Naktibalda. See #2231
* [WebDriver] added support for running tests on a remote server behind a proxy with `http_proxy` and `http_proxy_port` config options by @jdq22 *2015-07-29*
* [Laravel] Fixed issue with error handling for `haveRecord()` method in Laravel modules #2217 by @janhenkgerritsen *2015-07-28*
* Fixed displayed XML/HTML report path #2187 by @Naktibalda *2015-07-27*
* [WebDriver] Fixed `waitForElementChange` fatal error by @stipsan
* [Db] Enhanced dollar quoting ($$) processing in PostgreSQL driver by @YasserHassan *2015-07-20*
* [REST] Created tests for file-upload with REST module. By @Naktibalda *2015-08-08*
* [Lumen] Fixed issue where wrong request object was passed to the Lumen application by @janhenkgerritsen *2015-07-18*
#### 2.1.1
* [WebDriver] **Upgraded to facebook/webdriver 1.0** *2015-07-11*
WebDriver classes were moved to `Facebook\WebDriver` namespace. Please take that into account when using WebDriver API directly.
Till 2.2 Codeception will keep non-namespaced aliases of WebDriver classes.
* Module Reference now contains documentation for hidden API methods which should be used in Helper classes
* Skipped and Incomplete tests won't fire `test.before` and `test.after` events. For instance, WebDriver browser won't be started and Db cleanups won't be executed on incomplete or skipped tests.
* Annotations `skip` and `incomplete` enabled in Cest files #2131
* [WebDriver][PhpBrowser][Frameworks] `_findElements($locator)` method added to use in Helper classes *2015-07-11*
Now you can use `$this->getModule('WebDriver')->findElements('.user');` in Helpers to match all elements with `user` class using WebDriver module
* [PhpBrowser] Fixed `amOnUrl` method to open absolute URLs.
* [PhpBrowser][Frameworks] Fix for `fillField` using values that contain ampersands by @GawainLynch and @zbateson Issue #2132
* [WebDriver][PhpBrowser][Frameworks] Fixed missing HTTPS when trying to access protected pages #2141
#### 2.1.0
* [Recorder](https://github.com/Codeception/Codeception/tree/master/ext#codeceptionextensionrecorder) extension added. Shows acceptance test progress with a recorded slideshow.
* **Updated to Guzzle 6**. Codeception can now work both with Guzzle v5 and Guzzle v6. PhpBrowser chooses right connector depending on Guzzle version installed. By @davertmik and @enumag
* Annotations in Cept files.
Instead of calling `$scenario->skip()`, `$scenario->group('firefox')`, etc, it is recommended to set scenario metadata with annotations `// @skip`, `// @group firefox`.
Annotations can be parsed from line or block comments. `$scenario->skip()` and `$scenario->incomplete()` are still valid and can be executed inside conditional statements:
```
if (!extension_loaded('xdebug')) $scenario->skip('Xdebug required')
```
* **PSR-4**: all support classes moved to `tests/_support` by default. Actors, Helpers, PageObjects, StepObjects, GroupObjects to follow PSR-4 naming style. Autoloader implemented by @splinter89.
* **Dependency Injection**: support classes can be injected into tests. Support classes can be injected into each other too. This happens by implementing method `_inject` and explicitly specifying class names as parameters. Implemented by @splinter89.
* **Actor classes can be extended**, their generated parts were moved to special traits in `_generated` namespace. Each *Tester class can be updated with custom methods.
* **Module config simplified**: Modules can be configured in `enabled` section of suite config.
* **Conflicts**: module can define conflicts with each other by implementing `_conflicts` method
* **Dependencies**: module can explicitly define dependencies and expect their injection by implementing `_inject` and `_depends` methods and relying on dependency injection container.
* **Current** modules, environment, and test name can be received in scenario. Example: `$scenario->current('env')` returns current environment name. Fixes #1251
* **Environment Matrix**: environments can be merged. Environment configs can be created in `tests/_envs`, environment generator added. Implemented by By @sjableka. See #1747
* **Custom Printers**: XML, JSON, TAP, Report printers can be redefined in configuration. See #1425
* [Db] Added `reconnect` option for long running tests, which will connect to database before the test and disconnect after. By @Naktibalda
* Module parts. Actions of modules can be loaded partially in order to disable actions which are not used in current tests. For instance, disable web actions of framework modules in unit testsing.
* **Kohana**, **Symfony1**, **Doctrine1** modules considered deprecated and moved to standalone packages.
* `shuffle` added to settings. Randomizes order of running tests. See #1504
* Console output improved: scenario stack traces contain files and lines of fail.
* [Doctrine2][Symfony2] `symfony_em_service` config option moved from Doctrine2 to Symfony2 module and renamed to `em_service` *2015-06-03*
* [PhpBrowser][Frameworks] Fixed cloning form nodes `Codeception\Lib\InnerBrowser::getFormFromCrawler(): ID XXX already defined` *2015-05-13*
* [WebDriver] session snapshot implemented, allows to store cookies and load them, i.e., to keep user session between testss.
* [WebDriver][PhpBrowser][Frameworks] Malformed XPath locators wil throw an exception #1441
* `MODULE_INIT` event is fired before initializing modules #1370
* Graceful tests termination using `pcntl_signal`. See #1286
* Group classes renamed to GroupObjects; Base GroupObject class renamed to `Codeception\GroupObject`
* Official extensions moved to `ext` dir; Base Extension class renamed to `Codeception\Extension`
* Duplicate environment options won't cause Codeception to run environment tests twice
* [Phalcon1] `haveServiceInDi` method implemented by @sergeyklay
* [Db] `seeNumRecords` method added by @sergeyklayPK 1pN[od d CONTRIBUTING.mdnu W+A # How to contribute
At Codeception we are glad to receive contributions and patches from the community. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
Please check the guide for sending your contributions with Github at
https://github.com/Codeception/Codeception/wiki/Git-workflow-for-Codeception-contributors
## Coding Standards
All contributions must follow [PSR-2](http://www.php-fig.org/psr/psr-2/) coding standard.
## Code
**Bugfixes should be sent to to current stable branch, which is the same as major version number.**
Breaking features and major improvements should be sent into `master`. When you send PRs to master, they will be added to release cycle only when the next stable branch is started.
## Tests
Check the [tests/README.md](tests/README.md) to learn how to run and write internal tests.
We encourage you to write a test for a patch you are implementing. If this doesn't seem possible, such PRs are stil valid and can be accepted.
We also encourage to submit bug reports with a failing test or test environment (3rd party repo with Codeception installation) with demonstration of a failure. That makes easier to us to find the cause and fix it.
## Documentation
### Guides
If you want to contribute documentation to the guides you are asked to send your changes to the /docs/ folder: https://github.com/Codeception/Codeception/tree/2.2/docs. Theses files are the source for the codeception website guides: http://codeception.com/docs/01-Introduction. Remind to send your documentation improvements to the right "repository branch" depending on the Codeception version you are working with: 2.2, master,...
### Modules Documentation
The documentation for each module is directly generated from the corresponding docblock which can be found in each module (src/Codeception/Module/*.php).
PK 1pNV?Yi i
.gitignorenu W+A .idea
.roboci
composer.phar
composer.lock
vendor
package/codecept.phar
package/codecept5.phar
package/php54/codecept.phar
tests/support/_generated
tests/data/app/db
tests/data/sandbox
tests/_output/*
tests/data/included/_log/*
tests/data/included/jazz/tests/_log/*
tests/data/included/jazz/pianist/tests/_log/*
tests/data/included/shire/tests/_log/*
tests/data/included_w/_log/*
tests/data/included_w/src/foo/AcmePack/tests/_log/*
tests/data/included_w/src/foo/AcmePack/tests/_support/_generated/*
tests/data/included_mix/src/foo/AcmePack/tests/_log/*
tests/data/included_mix/src/foo/AcmePack/tests/_support/_generated/*
tests/data/included_mix/_log/*
tests/data/included_mix/support/_generated/*
tests/data/claypit/tests/_log/*
tests/data/claypit/tests/_output/*
tests/data/claypit/tests/_support/_generated/*
tests/data/claypit/c3tmp
tests/data/included/jazz/pianist/tests/_helpers/_generated/TestGuyActions.php
tests/data/included/jazz/tests/_helpers/_generated/TestGuyActions.php
tests/data/included/shire/tests/_helpers/_generated/TestGuyActions.php
tests/data/included_w/src/bar/Sub/EwokPack/tests/_support/_generated/UnitTesterActions.php
tests/data/included_w/src/bar/ToastPack/tests/_support/_generated/UnitTesterActions.php
tests/data/included_w/src/foo/AcmePack/tests/_support/_generated/UnitTesterActions.php
tests/data/params/tests/_support/_generated/DummyTesterActions.php
tests/data/exception_in_before/tests/_support/_generated/UnitTesterActions.php
tests/data/exception_in_before/tests/_output/
tests/data/bundled_suites/_support/_generated/UnitTesterActions.php
tests/data/bundled_suites/_output/
.DS_Store
robo.phar
.env
PK 1pN1 RoboFile.phpnu W+A say("CODECEPTION RELEASE: ".\Codeception\Codecept::VERSION);
$this->update();
$this->buildDocs();
$this->publishDocs();
$this->buildPhar();
$this->buildPhar5();
$this->publishPhar();
$this->publishGit();
$this->publishBase(null, \Codeception\Codecept::VERSION);
$this->versionBump();
$this->update(); //update dependencies after release, because buildPhar5 set them to old versions
}
public function versionBump($version = '')
{
if (!$version) {
$versionParts = explode('.', \Codeception\Codecept::VERSION);
$versionParts[count($versionParts)-1]++;
$version = implode('.', $versionParts);
}
$this->say("Bumping version to $version");
$this->taskReplaceInFile('src/Codeception/Codecept.php')
->from(\Codeception\Codecept::VERSION)
->to($version)
->run();
}
public function update()
{
$this->clean();
$this->taskComposerUpdate()->dir('tests/data/claypit')->run();
$this->taskComposerUpdate()->run();
}
public function changed($change)
{
$this->taskChangelog()
->version(\Codeception\Codecept::VERSION)
->change($change)
->run();
}
protected function server()
{
$this->taskServer(8000)
->background()
->dir('tests/data/app')
->run();
}
public function testPhpbrowser($args = '', $opt = ['test|t' => null])
{
$test = $opt['test'] ? ':'.$opt['test'] : '';
$this->server();
$this->taskCodecept('./codecept')
->args($args)
->test('tests/unit/Codeception/Module/PhpBrowserTest.php'.$test)
->run();
}
public function testRestBrowser($args = '', $opt = ['test|t' => null])
{
$test = $opt['test'] ? ':'.$opt['test'] : '';
$this->taskServer(8010)
->background()
->dir('tests/data')
->run();
$this->taskCodecept('./codecept')
->test('tests/unit/Codeception/Module/PhpBrowserRestTest.php'.$test)
->args($args)
->run();
}
public function testCoverage()
{
$this->server();
$this->taskSymfonyCommand(new \Codeception\Command\Run('run'))
->arg('suite', 'coverage')
->run();
}
public function testWebdriver($args = '', $opt = ['test|t' => null])
{
$test = $opt['test'] ? ':'.$opt['test'] : '';
$this->taskServer(8000)
->dir('tests/data/app')
->background()
->host('0.0.0.0')
->run();
$this->taskCodecept('./codecept')
->suite('web')
->args($args)
->run();
}
public function testLaunchServer()
{
$this->taskServer(8010)
->background()
->dir('tests/data/rest')
->run();
$this->taskServer(8000)
->dir('tests/data/app')
->run();
}
public function testCli()
{
$this->taskSymfonyCommand(new \Codeception\Command\Run('run'))
->arg('suite', 'cli')
->run();
$this->taskSymfonyCommand(new \Codeception\Command\Run('run'))
->arg('suite', 'tests/unit/Codeception/Command')
->run();
}
private function installDependenciesForPhp5()
{
$this->taskReplaceInFile('composer.json')
->regex('/"platform": \{.*?\}/')
->to('"platform": {"php": "5.6.0"}')
->run();
$this->taskComposerUpdate()->run();
}
private function installDependenciesForPhp70()
{
$this->taskReplaceInFile('composer.json')
->regex('/"platform": \{.*?\}/')
->to('"platform": {"php": "7.0.0"}')
->run();
$this->taskComposerUpdate()->run();
}
private function revertComposerJsonChanges()
{
$this->taskReplaceInFile('composer.json')
->regex('/"platform": \{.*?\}/')
->to('"platform": {}')
->run();
}
/**
* @desc creates codecept.phar
* @throws Exception
*/
public function buildPhar()
{
$this->installDependenciesForPhp70();
$this->packPhar('package/codecept.phar');
$code = $this->taskExec('php codecept.phar')->dir('package')->run()->getExitCode();
if ($code !== 0) {
throw new Exception("There was problem compiling phar");
}
$this->revertComposerJsonChanges();
}
/**
* @desc creates codecept.phar with Guzzle 5.3 and Symfony 2.8
* @throws Exception
*/
public function buildPhar5()
{
if (!file_exists('package/php54')) {
mkdir('package/php54');
}
$this->installDependenciesForPhp5();
$this->packPhar('package/codecept5.phar');
$this->_copy('package/codecept5.phar', 'package/php54/codecept.phar');
$code = $this->taskExec('php codecept.phar')->dir('package/php54')->run()->getExitCode();
if ($code !== 0) {
throw new Exception("There was problem compiling phar");
}
$this->revertComposerJsonChanges();
}
private function packPhar($pharFileName)
{
$pharTask = $this->taskPackPhar($pharFileName)
->compress()
->stub('package/stub.php');
$finder = Finder::create()
->ignoreVCS(true)
->name('*.php')
->name('*.tpl.dist')
->name('*.html.dist')
->in('src');
foreach ($finder as $file) {
$pharTask->addFile('src/'.$file->getRelativePathname(), $file->getRealPath());
}
$finder = Finder::create()
->ignoreVCS(true)
->name('*.php')
->in('ext');
foreach ($finder as $file) {
$pharTask->addFile('ext/'.$file->getRelativePathname(), $file->getRealPath());
}
$finder = Finder::create()->files()
->ignoreVCS(true)
->name('*.php')
->name('*.css')
->name('*.png')
->name('*.js')
->name('*.css')
->name('*.eot')
->name('*.svg')
->name('*.ttf')
->name('*.wof')
->name('*.woff')
->name('*.woff2')
->name('*.png')
->name('*.tpl.dist')
->name('*.html.dist')
->exclude('videlalvaro')
->exclude('php-amqplib')
->exclude('pheanstalk')
->exclude('phpseclib')
->exclude('codegyre')
->exclude('monolog')
->exclude('phpspec')
->exclude('squizlabs')
->exclude('Tests')
->exclude('tests')
->exclude('benchmark')
->exclude('demo')
->in('vendor');
foreach ($finder as $file) {
$pharTask->addStripped('vendor/'.$file->getRelativePathname(), $file->getRealPath());
}
$pharTask->addFile('autoload.php', 'autoload.php')
->addFile('codecept', 'package/bin')
->addFile('shim.php', 'shim.php');
if (file_exists(__DIR__ .'phpunit5-loggers.php')) {
$pharTask->addFile('phpunit5-loggers.php', 'phpunit5-loggers.php');
}
$pharTask->run();
}
/**
* @desc generates modules reference from source files
*/
public function buildDocs()
{
$this->say('generating documentation from source files');
$this->buildDocsModules();
$this->buildDocsUtils();
$this->buildDocsCommands();
$this->buildDocsStub();
$this->buildDocsApi();
$this->buildDocsExtensions();
}
public function buildDocsModules()
{
$this->taskCleanDir('docs/modules')->run();
$this->say("Modules");
$modules = Finder::create()->files()->name('*.php')->in(__DIR__ . '/src/Codeception/Module');
foreach ($modules as $module) {
$moduleName = basename(substr($module, 0, -4));
$className = 'Codeception\Module\\' . $moduleName;
$source = "https://github.com/Codeception/Codeception/tree/"
.self::STABLE_BRANCH."/src/Codeception/Module/$moduleName.php";
$this->taskGenDoc('docs/modules/' . $moduleName . '.md')
->docClass($className)
->prepend('# '.$moduleName)
->append('
')
->processClassSignature(false)
->processClassDocBlock(function (\ReflectionClass $c, $text) {
return "$text\n## Actions";
})->processProperty(false)
->filterMethods(function (\ReflectionMethod $method) use ($className) {
if ($method->isConstructor() or $method->isDestructor()) {
return false;
}
if (!$method->isPublic()) {
return false;
}
if (strpos($method->name, '_') === 0) {
$doc = $method->getDocComment();
try {
$doc = $doc . $method->getPrototype()->getDocComment();
} catch (\ReflectionException $e) {
}
if (strpos($doc, '@api') === false) {
return false;
}
};
return true;
})->processMethod(function (\ReflectionMethod $method, $text) use ($className, $moduleName) {
$title = "\n### {$method->name}\n";
if (strpos($method->name, '_') === 0) {
$text = str_replace("@api\n", '', $text);
$text = "\n*hidden API method, expected to be used from Helper classes*\n" . $text;
$text = str_replace("{{MODULE_NAME}}", $moduleName, $text);
};
if (!trim($text)) {
return $title . "__not documented__\n";
}
$text = str_replace(
['@since', '@version'],
[' * `Available since`', ' * `Available since`'],
$text
);
$text = str_replace('@part ', ' * `[Part]` ', $text);
$text = str_replace("@return mixed\n", '', $text);
$text = preg_replace('~@return (.*?)~', ' * `return` $1', $text);
$text = preg_replace("~^@(.*?)([$\s])~", ' * `$1` $2', $text);
$result = $title . $text;
return preg_replace('/\n(\s*\n){2,}/', "\n\n", $result);
})->processMethodSignature(false)
->reorderMethods('ksort')
->run();
}
}
public function buildDocsUtils()
{
$this->say("Util Classes");
$utils = ['Autoload', 'Fixtures', 'Locator', 'XmlBuilder', 'JsonType', 'HttpCode'];
foreach ($utils as $utilName) {
$className = '\Codeception\Util\\' . $utilName;
$source = self::REPO_BLOB_URL."/".self::STABLE_BRANCH."/src/Codeception/Util/$utilName.php";
$this->documentApiClass('docs/reference/' . $utilName . '.md', $className, $source);
}
}
public function buildDocsStub()
{
$this->say("Stub Classes");
$this->taskGenDoc('docs/reference/Stub.md')
->docClass('Codeception\Stub')
->filterMethods(function (\ReflectionMethod $method) {
if ($method->isConstructor() or $method->isDestructor()) {
return false;
}
if (!$method->isPublic()) {
return false;
}
if (strpos($method->name, '_') === 0) {
return false;
}
return true;
})
->processMethodDocBlock(
function (\ReflectionMethod $m, $doc) {
$doc = str_replace(array('@since'), array(' * available since version'), $doc);
$doc = str_replace(array(' @', "\n@"), array(" * ", "\n * "), $doc);
return $doc;
}
)
->processProperty(false)
->run();
$mocksDocumentation = <<taskGenDoc('docs/reference/Mock.md')
->docClass('Codeception\Test\Feature\Stub')
->docClass('Codeception\Stub\Expected')
->processClassDocBlock(false)
->processClassSignature(false)
->prepend($mocksDocumentation)
->filterMethods(function (\ReflectionMethod $method) {
if ($method->isConstructor() or $method->isDestructor()) {
return false;
}
if (!$method->isPublic()) {
return false;
}
if (strpos($method->name, '_') === 0) {
return false;
}
if (strpos($method->name, 'stub') === 0) {
return false;
}
return true;
})
->run();
}
public function buildDocsApi()
{
$this->say("API Classes");
$apiClasses = ['Codeception\Module', 'Codeception\InitTemplate'];
foreach ($apiClasses as $apiClass) {
$name = (new ReflectionClass($apiClass))->getShortName();
$this->documentApiClass('docs/reference/' . $name . '.md', $apiClass, true);
}
}
public function buildDocsCommands()
{
$this->say("Commands");
$commands = Finder::create()->files()->name('*.php')->depth(0)->in(__DIR__ . '/src/Codeception/Command');
$commandGenerator = $this->taskGenDoc('docs/reference/Commands.md');
foreach ($commands as $command) {
$commandName = basename(substr($command, 0, -4));
$className = '\Codeception\Command\\' . $commandName;
$commandGenerator->docClass($className);
}
$commandGenerator
->prepend("# Console Commands\n")
->processClassSignature(function ($r, $text) {
return "## ".$r->getShortName();
})
->filterMethods(function (ReflectionMethod $r) {
return false;
})
->run();
}
public function buildDocsExtensions()
{
$this->say('Extensions');
$extensions = Finder::create()->files()->sortByName()->name('*.php')->in(__DIR__ . '/ext');
$extGenerator= $this->taskGenDoc(__DIR__.'/ext/README.md');
foreach ($extensions as $extension) {
$extensionName = basename(substr($extension, 0, -4));
$className = '\Codeception\Extension\\' . $extensionName;
$extGenerator->docClass($className);
}
$extGenerator
->prepend("# Official Extensions\n")
->processClassSignature(function (ReflectionClass $r, $text) {
$name = $r->getShortName();
return "## $name\n\n[See Source](" . self::REPO_BLOB_URL."/".self::STABLE_BRANCH. "/ext/$name.php)";
})
->filterMethods(function (ReflectionMethod $r) {
return false;
})
->filterProperties(function ($r) {
return false;
})
->run();
}
/**
* @desc publishes generated phar to codeception.com
*/
public function publishPhar()
{
$this->cloneSite();
$version = \Codeception\Codecept::VERSION;
if (strpos($version, self::STABLE_BRANCH) === 0) {
$this->say("publishing to release branch");
copy('../codecept.phar', 'codecept.phar');
if (!is_dir('php54')) {
mkdir('php54');
}
copy('../php54/codecept.phar', 'php5/codecept.phar');
$this->taskExec('git add codecept.phar')->run();
$this->taskExec('git add php5/codecept.phar')->run();
}
$this->taskFileSystemStack()
->mkdir("releases/$version")
->mkdir("releases/$version/php54")
->copy('../codecept.phar', "releases/$version/codecept.phar")
->copy('../php54/codecept.phar', "releases/$version/php54/codecept.phar")
->run();
$this->taskGitStack()->add('-A')->run();
$sortByVersion = function (\SplFileInfo $a, \SplFileInfo $b) {
return version_compare($a->getBaseName(), $b->getBaseName());
};
$releases = array_reverse(
iterator_to_array(Finder::create()->depth(0)->directories()->sort($sortByVersion)->in('releases'))
);
$branch = null;
$releaseFile = $this->taskWriteToFile('builds.markdown')
->line('---')
->line('layout: page')
->line('title: Codeception Builds')
->line('---')
->line('');
foreach ($releases as $release) {
$releaseName = $release->getBasename();
$downloadUrl = "http://codeception.com/releases/$releaseName/codecept.phar";
list($major, $minor) = explode('.', $releaseName);
if ("$major.$minor" != $branch) {
$branch = "$major.$minor";
$releaseFile->line("\n## $branch");
if ($major < 2) {
$releaseFile->line("*Requires: PHP 5.3 and higher + CURL*\n");
} elseif ($major == 2 && $minor < 4) {
$releaseFile->line("*Requires: PHP 5.4 and higher + CURL*\n");
} else {
$releaseFile->line("*Requires: PHP 5.6 and higher + CURL*\n");
}
$releaseFile->line("* **[Download Latest $branch Release]($downloadUrl)**");
}
$versionLine = "* [$releaseName]($downloadUrl)";
if (file_exists("releases/$releaseName/php54/codecept.phar")) {
$downloadUrl = "http://codeception.com/releases/$releaseName/php54/codecept.phar";
if (version_compare($releaseName, '2.4.0', '>=')) {
$versionLine .= ", [for PHP 5.6]($downloadUrl)";
} elseif (version_compare($releaseName, '2.3.0', '>=')) {
$versionLine .= ", [for PHP 5.4 - 5.6]($downloadUrl)";
} else {
$versionLine .= ", [for PHP 5.4 or 5.5]($downloadUrl)";
}
}
$releaseFile->line($versionLine);
}
$releaseFile->run();
$this->publishSite();
}
/**
* Updates docs on codeception.com
*
*/
public function publishDocs()
{
if (strpos(\Codeception\Codecept::VERSION, self::STABLE_BRANCH) !== 0) {
$this->say("The ".\Codeception\Codecept::VERSION." is not in release branch. Site is not build");
return;
}
$this->say('building site...');
$this->cloneSite();
$this->taskCleanDir('docs')
->run();
$this->taskFileSystemStack()
->mkdir('docs/reference')
->mkdir('docs/modules')
->run();
chdir('../..');
$this->say('building changelog');
$this->taskWriteToFile('package/site/changelog.markdown')
->line('---')
->line('layout: page')
->line('title: Codeception Changelog')
->line('---')
->line('')
->line(
''
)
->line('')
->line('# Changelog')
->line('')
->line($this->processChangelog())
->run();
$docs = Finder::create()->files('*.md')->sortByName()->in('docs');
$modules = [];
$api = [];
$reference = [];
foreach ($docs as $doc) {
$newfile = $doc->getFilename();
$name = substr($doc->getBasename(), 0, -3);
$contents = $doc->getContents();
if (strpos($doc->getPathname(), 'docs'.DIRECTORY_SEPARATOR.'modules') !== false) {
$newfile = 'docs/modules/' . $newfile;
$modules[$name] = '/docs/modules/' . $doc->getBasename();
$contents = str_replace('## ', '### ', $contents);
$buttons = [
'source' => self::REPO_BLOB_URL."/".self::STABLE_BRANCH."/src/Codeception/Module/$name.php"
];
// building version switcher
foreach (['master', '2.3', '2.2', '2.1', '2.0', '1.8'] as $branch) {
$buttons[$branch] = self::REPO_BLOB_URL."/$branch/docs/modules/$name.md";
}
$buttonHtml = "\n\n".'';
foreach ($buttons as $link => $url) {
if ($link == self::STABLE_BRANCH) {
$link = "
$link";
}
$buttonHtml.= '
'.$link.'';
}
$buttonHtml .= '
'."\n\n";
$contents = $buttonHtml . $contents;
} elseif (strpos($doc->getPathname(), 'docs'.DIRECTORY_SEPARATOR.'reference') !== false) {
$newfile = 'docs/reference/' . $newfile;
$reference[$name] = '/docs/reference/' . $doc->getBasename();
} else {
$newfile = 'docs/'.$newfile;
$api[substr($name, 3)] = '/docs/'.$doc->getBasename();
}
copy($doc->getPathname(), 'package/site/' . $newfile);
$highlight_languages = implode('|', ['php', 'html', 'bash', 'yaml', 'json', 'xml', 'sql', 'gherkin']);
$contents = preg_replace(
"~```\s?($highlight_languages)\b(.*?)```~ms",
"{% highlight $1 %}\n$2\n{% endhighlight %}",
$contents
);
$contents = str_replace('{% highlight %}', '{% highlight yaml %}', $contents);
$contents = preg_replace("~```\s?(.*?)```~ms", "{% highlight yaml %}\n$1\n{% endhighlight %}", $contents);
// set default language in order not to leave unparsed code inside '```'
$matches = [];
$title = $name;
$contents = "---\nlayout: doc\ntitle: ".($title!="" ? $title." - " : "")
."Codeception - Documentation\n---\n\n".$contents;
file_put_contents('package/site/' .$newfile, $contents);
}
chdir('package/site');
$guides = array_keys($api);
foreach ($api as $name => $url) {
$filename = substr($url, 6);
$doc = file_get_contents('docs/'.$filename)."\n\n\n";
$i = array_search($name, $guides);
if (isset($guides[$i+1])) {
$next_title = $guides[$i+1];
$next_url = $api[$guides[$i+1]];
$next_url = substr($next_url, 0, -3);
$doc .= "\n* **Next Chapter: [$next_title >]($next_url)**";
}
if (isset($guides[$i-1])) {
$prev_title = $guides[$i-1];
$prev_url = $api[$guides[$i-1]];
$prev_url = substr($prev_url, 0, -3);
$doc .= "\n* **Previous Chapter: [< $prev_title]($prev_url)**";
}
$this->taskWriteToFile('docs/'.$filename)
->text($doc)
->run();
}
$guides_list = '';
foreach ($api as $name => $url) {
$url = substr($url, 0, -3);
$name = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\\1 \\2', $name);
$name = preg_replace('/([a-z\d])([A-Z])/', '\\1 \\2', $name);
$guides_list .= ''.$name.'';
}
file_put_contents('_includes/guides.html', $guides_list);
$this->say("Building Guides index");
$this->taskWriteToFile('_includes/guides.html')
->text($guides_list)
->run();
$this->taskWriteToFile('docs/index.html')
->line('---')
->line('layout: doc')
->line('title: Codeception Documentation')
->line('---')
->line('')
->line("Codeception Documentation Guides
")
->line('')
->text($guides_list)
->run();
/**
* Align modules in two columns like this:
* A D
* B E
* C
*/
$modules_cols = 2;
$modules_rows = ceil(count($modules) / $modules_cols);
$module_names_chunked = array_chunk(array_keys($modules), $modules_rows);
$modules_list = '';
for ($i = 0; $i < $modules_rows; $i++) {
for ($j = 0; $j < $modules_cols; $j++) {
if (isset($module_names_chunked[$j][$i])) {
$name = $module_names_chunked[$j][$i];
$url = substr($modules[$name], 0, -3);
$modules_list .= ''.$name.'';
}
}
}
file_put_contents('_includes/modules.html', $modules_list);
$reference_list = '';
foreach ($reference as $name => $url) {
if ($name == 'Commands') {
continue;
}
if ($name == 'Configuration') {
continue;
}
$url = substr($url, 0, -3);
$reference_list .= ''.$name.'';
}
file_put_contents('_includes/reference.html', $reference_list);
$this->say("Writing extensions docs");
$this->taskWriteToFile('_includes/extensions.md')
->textFromFile(__DIR__.'/ext/README.md')
->run();
$this->publishSite();
$this->taskExec('git add')->args('.')->run();
}
/**
* @desc creates a new version tag and pushes to github
* @param null $branch
* @param array $opt
*/
public function publishGit($branch = null, $opt = ['tag|t' => null])
{
$version = isset($opt['tag']) ? $opt['tag'] : \Codeception\Codecept::VERSION;
$this->say('creating new tag for '.$version);
if (!$branch) {
$branch = explode('.', $version);
array_pop($branch);
$branch = implode('.', $branch);
}
$this->taskExec("git tag $version")->run();
$this->taskExec("git push origin $branch --tags")->run();
}
protected function processChangelog()
{
$sortByVersionDesc = function (\SplFileInfo $a, \SplFileInfo $b) {
$pattern = '/^CHANGELOG-(\d+\.\d+).md$/';
if (preg_match($pattern, $a->getBasename(), $matches1) && preg_match($pattern, $b->getBasename(), $matches2)) {
return version_compare($matches1[1], $matches2[1]) * -1;
}
return 0;
};
$changelogFiles = Finder::create()->name('CHANGELOG-*.md')->in('.')->depth(0)->sort($sortByVersionDesc);
$changelog = '';
foreach ($changelogFiles as $file) {
$changelog .= $file->getContents();
}
//user
$changelog = preg_replace('~\s@([\w-]+)~', ' **[$1](https://github.com/$1)**', $changelog);
//issue
$changelog = preg_replace(
'~#(\d+)~',
'[#$1](https://github.com/Codeception/Codeception/issues/$1)',
$changelog
);
//module
$changelog = preg_replace('~\s\[(\w+)\]\s~', ' **[$1]** ', $changelog);
return $changelog;
}
/**
* @desc cleans all log and temp directories
*/
public function clean()
{
$this->taskCleanDir([
'tests/log',
'tests/data/claypit/tests/_output',
'tests/data/included/_log',
'tests/data/included/jazz/tests/_log',
'tests/data/included/shire/tests/_log',
])->run();
$this->taskDeleteDir([
'tests/data/claypit/c3tmp',
'tests/data/sandbox'
])->run();
}
public function buildActors()
{
$build = 'php codecept build';
$this->taskExec($build)->run();
$this->taskExec($build)->args('-c tests/data/claypit')->run();
$this->taskExec($build)->args('-c tests/data/included')->run();
$this->taskExec($build)->args('-c tests/data/included/jazz')->run();
$this->taskExec($build)->args('-c tests/data/included/shire')->run();
$this->taskExec($build)->args('-c tests/data/included/jazz')->run();
}
protected function cloneSite()
{
@mkdir("package/site");
$this->taskExec('git clone')
->args('git@github.com:Codeception/codeception.github.com.git')
->args('package/site/')
->run();
chdir('package/site');
}
protected function publishSite()
{
$this->taskGitStack()
->add('-A')
->commit('auto updated documentation')
->push()
->run();
chdir('..');
sleep(2);
$this->taskDeleteDir('site')->run();
chdir('..');
$this->say("Site build succesfully");
}
/**
* Publishes Codeception base
* @param null $branch
* @param null $tag
*/
public function publishBase($branch = null, $tag = null)
{
if (!$branch) {
$branch = self::STABLE_BRANCH;
}
$this->say("Updating Codeception Base distribution");
$tempBranch = "tmp".uniqid();
$this->taskGitStack()
->checkout("-b $tempBranch")
->run();
$this->taskReplaceInFile('composer.json')
->from('"codeception/codeception"')
->to('"codeception/base"')
->run();
$this->taskReplaceInFile('composer.json')
->regex('~^\s+"facebook\/webdriver".*$~m')
->to('')
->run();
$this->taskReplaceInFile('composer.json')
->regex('~^\s+"guzzlehttp\/guzzle".*$~m')
->to('')
->run();
$this->taskComposerUpdate()->run();
$this->taskGitStack()
->add('composer.json')
->commit('auto-update')
->exec("push -f base $tempBranch:$branch")
->run();
if ($tag) {
$this->taskGitStack()
->exec("tag -d $tag")
->exec("push base :refs/tags/$tag")
->exec("tag $tag")
->push('base', $tag)
->run();
}
$this->taskGitStack()
->checkout('-- composer.json')
->checkout($branch)
->exec("branch -D $tempBranch")
->run();
}
/**
* Checks Codeception code style
* Most useful values for `report` option: `full`, `summary`, `diff`
*
* @param array $opt
*/
public function codestyleCheck($opt = ['report|r' => 'summary'])
{
$this->say("Checking code style");
$this->taskExec('php vendor/bin/phpcs')
->arg('.')
->arg('--standard=ruleset.xml')
->arg('--report=' . $opt['report'])
->arg('--ignore=tests,vendor,package,docs')
->run();
}
public function codestyleFix()
{
$this->taskExec('php vendor/bin/phpcbf')
->arg('.')
->arg('--standard=ruleset.xml')
->arg('--ignore=tests,vendor,package,docs')
->run();
}
/**
* @param $file
* @param $className
* @param $source
*/
protected function documentApiClass($file, $className, $all = false)
{
$uri = str_replace('\\', '/', $className);
$source = self::REPO_BLOB_URL."/".self::STABLE_BRANCH."/src/$uri.php";
$this->taskGenDoc($file)
->docClass($className)
->filterMethods(function (ReflectionMethod $r) use ($all, $className) {
return $all || $r->isPublic();
})
->append(
'
'
)
->processPropertySignature(function ($r) {
return "\n#### $" . $r->name. "\n\n";
})
->processPropertyDocBlock(function ($r, $text) {
$modifiers = implode(' ', \Reflection::getModifierNames($r->getModifiers()));
$text = ' *' . $modifiers . '* **$' . $r->name . "**\n" . $text;
$text = preg_replace("~@(.*?)\s(.*)~", 'type `$2`', $text);
return $text;
})
->processClassDocBlock(
function (ReflectionClass $r, $text) {
return $text . "\n";
}
)
->processMethodSignature(function ($r, $text) {
return "#### {$r->name}()\n\n" . ltrim($text, '#');
})
->processMethodDocBlock(
function (ReflectionMethod $r, $text) use ($file) {
$file = str_replace(__DIR__, '', $r->getFileName());
$source = self::REPO_BLOB_URL."/".self::STABLE_BRANCH. $file;
$line = $r->getStartLine();
$text = preg_replace("~^\s?@(.*?)\s~m", ' * `$1` $2', $text);
$text .= "\n[See source]($source#L$line)";
return "\n" . $text . "\n";
}
)
->reorderMethods('ksort')
->run();
}
}
PK 1pNlh package/stub.phpnu W+A #!/usr/bin/env php
add(new Codeception\Command\Build('build'));
$app->add(new Codeception\Command\Run('run'));
$app->add(new Codeception\Command\Init('init'));
$app->add(new Codeception\Command\Console('console'));
$app->add(new Codeception\Command\Bootstrap('bootstrap'));
$app->add(new Codeception\Command\GenerateCept('generate:cept'));
$app->add(new Codeception\Command\GenerateCest('generate:cest'));
$app->add(new Codeception\Command\GenerateTest('generate:test'));
$app->add(new Codeception\Command\GenerateSuite('generate:suite'));
$app->add(new Codeception\Command\GenerateHelper('generate:helper'));
$app->add(new Codeception\Command\GenerateScenarios('generate:scenarios'));
$app->add(new Codeception\Command\Clean('clean'));
$app->add(new Codeception\Command\GenerateGroup('generate:groupobject'));
$app->add(new Codeception\Command\GeneratePageObject('generate:pageobject'));
$app->add(new Codeception\Command\GenerateStepObject('generate:stepobject'));
$app->add(new Codeception\Command\GenerateSnapshot('generate:snapshot'));
$app->add(new Codeception\Command\GenerateEnvironment('generate:environment'));
$app->add(new Codeception\Command\GenerateFeature('generate:feature'));
$app->add(new Codeception\Command\GherkinSnippets('gherkin:snippets'));
$app->add(new Codeception\Command\GherkinSteps('gherkin:steps'));
$app->add(new Codeception\Command\DryRun('dry-run'));
$app->add(new Codeception\Command\ConfigValidate('config:validate'));
$app->registerCustomCommands();
// add only if within a phar archive.
if ('phar:' === substr(__FILE__, 0, 5)) {
$app->add(new Codeception\Command\SelfUpdate('self-update'));
}
$app->run();
PK 1pNuL& + src/Codeception/Subscriber/Dependencies.phpnu W+A 'testStart',
Events::TEST_SUCCESS => 'testSuccess'
];
protected $successfulTests = [];
public function testStart(TestEvent $event)
{
$test = $event->getTest();
if (!$test instanceof Dependent) {
return;
}
$testSignatures = $test->fetchDependencies();
foreach ($testSignatures as $signature) {
if (!in_array($signature, $this->successfulTests)) {
$test->getMetadata()->setSkip("This test depends on $signature to pass");
return;
}
}
}
public function testSuccess(TestEvent $event)
{
$test = $event->getTest();
if (!$test instanceof TestInterface) {
return;
}
$this->successfulTests[] = Descriptor::getTestSignature($test);
}
}
PK 1pNzc * src/Codeception/Subscriber/AutoRebuild.phpnu W+A 'updateActor'
];
public function updateActor(SuiteEvent $e)
{
$settings = $e->getSettings();
if (!$settings['actor']) {
codecept_debug('actor is empty');
return; // no actor
}
$modules = $e->getSuite()->getModules();
$actorActionsFile = Configuration::supportDir() . '_generated' . DIRECTORY_SEPARATOR
. $settings['actor'] . 'Actions.php';
if (!file_exists($actorActionsFile)) {
codecept_debug("Generating {$settings['actor']}Actions...");
$this->generateActorActions($actorActionsFile, $settings);
return;
}
// load actor class to see hash
$handle = @fopen($actorActionsFile, "r");
if ($handle and is_writable($actorActionsFile)) {
$line = @fgets($handle);
if (preg_match('~\[STAMP\] ([a-f0-9]*)~', $line, $matches)) {
$hash = $matches[1];
$currentHash = Actions::genHash($modules, $settings);
// regenerate actor class when hashes do not match
if ($hash != $currentHash) {
codecept_debug("Rebuilding {$settings['actor']}...");
@fclose($handle);
$this->generateActorActions($actorActionsFile, $settings);
return;
}
}
@fclose($handle);
}
}
protected function generateActorActions($actorActionsFile, $settings)
{
if (!file_exists(Configuration::supportDir() . '_generated')) {
@mkdir(Configuration::supportDir() . '_generated');
}
$actionsGenerator = new Actions($settings);
$generated = $actionsGenerator->produce();
@file_put_contents($actorActionsFile, $generated);
}
}
PK 1pNãiZN ZN &