PHPackages                             viraj/cakephp-integrated - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. viraj/cakephp-integrated

ActiveLibrary[Testing &amp; Quality](/categories/testing)

viraj/cakephp-integrated
========================

Integration testing for CakePHP

3.0.3(5y ago)1968.9k↓88.2%2MITPHPPHP &gt;=7.2.0CI failing

Since Aug 4Pushed 5y ago7 watchersCompare

[ Source](https://github.com/viraj-khatavkar/cakephp-integrated)[ Packagist](https://packagist.org/packages/viraj/cakephp-integrated)[ RSS](/packages/viraj-cakephp-integrated/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (18)Used By (0)

CakePHP Integrated
==================

[](#cakephp-integrated)

Better integration testing with [CakePHP](https://cakephp.org). An intuitive API for integration testing your CakePHP applications.

Step 1: Installation &amp; Setup
--------------------------------

[](#step-1-installation--setup)

Install this package using Composer:

```
composer require viraj/cakephp-integrated --dev
```

You'll also need to set a baseUrl for your application. By default, it is set to "", however, you'll likely need to change this. Do so by adding a `$baseUrl` to your test class:

```
protected $baseUrl = 'http://your-dev-url';
```

> This package comes installed with the [TestDummy](https://github.com/viraj-khatavkar/cakephp-testdummy#step-2-create-a-factories-file) package. It is recommended to use factories and the `DatabaseMigrations` trait instead of `fixtures` for optimal productivity with this package. You can learn more about that in the official documentation of the [TestDummy](https://github.com/viraj-khatavkar/cakephp-testdummy#step-2-create-a-factories-file) package.

Step 2: Extend the base class:
------------------------------

[](#step-2-extend-the-base-class)

After CakePHP 3.4.1:

```
class DemoTest extends CakeTestCase
{
}
```

Before CakePHP 3.4.1

```
class DemoTest extends LegacyTestCase
{
}
```

Step 3: Write tests ;)
----------------------

[](#step-3-write-tests-)

The API for both the classes is going to be the same. We will use the `CakeTestCase` as an example. Here is an example test to help you understand how this works:

```
class DemoTest extends CakeTestCase
{
    use DatabaseMigrations;

    protected $baseUrl = "http://local.yourapp.dev";

    /** @test */
    public function unauthenticated_user_cannot_see_the_add_posts_page()
    {
        $this->openPage('/posts/add')
             ->canSeePageUrlContains('/users/login');
    }

    /** @test */
    public function authenticated_user_can_add_a_new_post()
    {
        $user = factory('Users')->create();

        $this->actingAs($user)
             ->openPage('/posts/add')
             ->fillInField('title', 'My first post')
             ->fillInField('author', 'Viraj Khatavkar')
             ->fillInField('body', 'My Post body')
             ->check('published')
             ->press('Submit')
             ->canSeePageIs('/posts')
             ->seeText('My first post');
    }
}
```

API
---

[](#api)

Here is the API of this package which can be used to write your tests:

**`$this->fillInField($elementName, $text)`**

Fill the text in the input field identified with name of element

```
$this->fillInField('name', 'Viraj Khatavkar');
```

**`$this->check($elementName)`**

Check the checkbox identified with name element

```
$this->check('agree_to_terms');
```

**`$this->uncheck($elementName)`**

Uncheck the checkbox identified with name of element

```
$this->uncheck('agree_to_terms');
```

**`$this->select($elementName, $option)`**

Select a radio button or an option from the dropdown field identified with name of element

```
//Dropdown
$this->select('state', 'Pennsylvania');

//Radio
$this->select('gender', 'M');
```

**`$this->press($buttonText)`**

Press a button with the provided name or text.

```
//Text of the button
$this->press('Submit');

//Name of the button
$this->press('submit');
```

**`$this->canSeePageIs($url)`**

Assert that the page URI matches the given url.

```
$this->canSeePageIs('/posts');
```

**`$this->canSeePageUrlContains($url)`**

Assert that the page URI contains the given url.

```
$this->canSeePageUrlContains('/po');
```

**`$this->actingAs($user)`**

Set the currently logged in user for the application.

```
$user = factory('Users')->create();

$this->actingAs($user)->openPage('/posts/add');
```

### Looking for a comprehensive guide on implementing TDD?

[](#looking-for-a-comprehensive-guide-on-implementing-tdd)

I'm writing a book on implementing TDD for real-world CakePHP applications! [Check it out](https://tddforcakephp.com/) if you are having a hard time on writing tests in a real world application.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~75 days

Recently: every ~10 days

Total

17

Last Release

2042d ago

Major Versions

0.1.0 → v1.02017-08-09

v1.0.5 → v2.02020-05-17

v2.3.2 → 3.02020-11-30

PHP version history (2 changes)0.1.0PHP &gt;=5.6.0

v2.3.1PHP &gt;=7.2.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5693836?v=4)[Viraj Khatavkar](/maintainers/viraj-khatavkar)[@viraj-khatavkar](https://github.com/viraj-khatavkar)

---

Top Contributors

[![viraj-khatavkar](https://avatars.githubusercontent.com/u/5693836?v=4)](https://github.com/viraj-khatavkar "viraj-khatavkar (37 commits)")

---

Tags

testingstubscakephpintegrationtestdummy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/viraj-cakephp-integrated/health.svg)

```
[![Health](https://phpackages.com/badges/viraj-cakephp-integrated/health.svg)](https://phpackages.com/packages/viraj-cakephp-integrated)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[drupal/drupal-extension

Drupal extension for Behat

22215.7M173](/packages/drupal-drupal-extension)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.6M343](/packages/drupal-core-dev)[laracasts/integrated

Simple, intuitive integration testing with PHPUnit.

479207.2k2](/packages/laracasts-integrated)[nunomaduro/laravel-mojito

A lightweight package for testing Laravel views.

369461.8k12](/packages/nunomaduro-laravel-mojito)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49617.1k](/packages/blackfire-player)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
