PHPackages                             cakephp/codeception - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. cakephp/codeception

AbandonedArchivedLibrary[Framework](/categories/framework)

cakephp/codeception
===================

Run CakePHP tests using Codeception

458.4k25[4 issues](https://github.com/cakephp/codeception/issues)[1 PRs](https://github.com/cakephp/codeception/pulls)1PHP

Since Jun 25Pushed 3y ago23 watchersCompare

[ Source](https://github.com/cakephp/codeception)[ Packagist](https://packagist.org/packages/cakephp/codeception)[ RSS](/packages/cakephp-codeception/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (1)

CakePHP 3 Codeception Module
============================

[](#cakephp-3-codeception-module)

[![Build Status](https://camo.githubusercontent.com/eab2756c0ffee5caaa1f614fd395ac63c7baf6978497b1ab29ed444c036a21cd/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f63616b657068702f636f646563657074696f6e3f7374796c653d666c61742d737175617265)](https://travis-ci.com/cakephp/codeception)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

⚠️ This repository is archived and is no longer maintained.

A [codeception](http://codeception.com) module to test your CakePHP 3 powered application. Using Codeception with CakePHP opens up a whole new set of testing capabilities.

##### Front-end testing

[](#front-end-testing)

*(i.e. browser-based workflow tests)*

- [\[Functional Tests\]](http://codeception.com/docs/05-FunctionalTests)
    - does the App run the way we expect
- [\[Acceptance Tests\]](http://codeception.com/docs/04-AcceptanceTests)
    - does the App do what the customer/user expects

##### Back-end testing

[](#back-end-testing)

*(i.e. direct, internal method tests)*

- [\[API Tests\]](http://codeception.com/docs/10-WebServices)
    - does the App's API work
- [\[Unit Tests\]](http://codeception.com/docs/06-UnitTests)
    - do the App's internal functions do what we expect

Usage
-----

[](#usage)

From a CakePHP application, run the following from the command-line:

```
$ composer require --dev cakephp/codeception:dev-master && composer run-script post-install-cmd
```

If you are developing a plugin, add the post-install script to your `composer.json` first:

```
{
    "scripts": {
        "post-install-cmd": "Cake\\Codeception\\Console\\Installer::customizeCodeceptionBinary"
    }
}
```

Once installed, you can now run `bootstrap` which will create all the codeception required files in your application:

```
$ vendor/bin/codecept bootstrap
```

This creates the following files/folders in your `app` directory:

```
├── codeception.yml
├── src
│   └── TestSuite
│       └── Codeception
|           ├── AcceptanceTester.php
|           ├── FunctionalTester.php
|           ├── UnitTester.php
|           ├── Helper
│           │   ├── Acceptance.php
│           │   ├── Functional.php
│           │   └── Unit.php
|           └── _generated
|               └── .gitignore
└── tests
    ├── Acceptance.suite.yml
    ├── Functional.suite.yml
    ├── Unit.suite.yml
    ├── Acceptance
    │   └── bootstrap.php
    ├── Fixture
    │   └── dump.sql
    ├── Functional
    │   └── bootstrap.php
    └── Unit
        └── bootstrap.php

```

As you might have noticed, the CakePHP implementation differs in a couple things:

- uses CamelCase suite names (`Functional` vs. `functional`)
- uses `bootstrap.php`, no underscore prefix (vs. `_bootstrap.php`)
- uses `src/TestSuite/Codeception` for custom modules (helpers) (vs. `tests/_helpers`)
- uses `tmp/tests` to store logs (vs. `tests/_logs`)
- uses `tests/Fixture` to fixture data (vs. `tests/_data`)
- uses `tests/Envs` to fixture data (vs. `tests/_envs`)
- adds a `.gitignore` to never track auto-generated files
- adds custom templates for various generated files using the `codecept` binary

To better understand how Codeception tests work, please check the [official documentation](http://codeception.com/docs/01-Introduction).

Example Cept
------------

[](#example-cept)

```
