PHPackages                             tyler36/cypress-cake - 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. tyler36/cypress-cake

ActiveCakephp-plugin[Testing &amp; Quality](/categories/testing)

tyler36/cypress-cake
====================

Cypress plugin for CakePHP

v2.1(1y ago)014MITPHPPHP ^7.4|^8.1CI passing

Since Oct 25Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tyler36/cypress-cake)[ Packagist](https://packagist.org/packages/tyler36/cypress-cake)[ RSS](/packages/tyler36-cypress-cake/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (11)Used By (0)

Cypress plugin for CakePHP
===========================

[](#cypress-plugin-for-cakephp-)

- [Overview](#overview)
- [Installation](#installation)
- [Helpers](#helpers)
    - [Clear Database](#clear-database)
    - [Import Database](#import-database)
    - [Create An Entity](#create-an-entity)
    - [Run Arbitrary Cake Command](#run-arbitrary-cake-command)
- [Contributing](#contributing)

Overview
--------

[](#overview)

This add-on adds some helper files for working with Cypress and CakePHP.

- This plugin injects a CSRF token into POST requests made to `cypress-cake` endpoints.
- This plugin bypasses `Authentication` on `cypress-cake` endpoints.

Important

This plugin exposes an API to work with the database. It is recommend for local development only. Do not use in production!

Installation
------------

[](#installation)

1. Install plugin

    ```
    ddev composer require tyler36/cypress-cake
    ddev cake plugin load Tyler36/CypressCake
    ```
2. Install Cypress if not available. Eg.

    - via NPM: `npm require cypress`
    - via [tyler36/ddev-cypress](https://github.com/tyler36/ddev-cypress): `ddev addon get tyler36/ddev-cypress`
3. Update `cypress/support/commands.js` to import the helpers

    ```
    import '../../vendor/tyler36/cypress-cake/src/support/cypress-commands'
    ```

Helpers
-------

[](#helpers)

APIDescription`/cypress/clear-database`Clear all data from database.`/cypress/import-database`Import a database file.`/cypress/csrf-token`Get a CSRF token. This is required POST forms.`/cypress/create`Run a factory to generate a entity.`/cypress/cake`Run arbitrary cake commands.### Clear Database

[](#clear-database)

Use the Cypress command `cy.clearDatabase()` to clear all data from database.

```
cy.clearDatabase()
```

### Import Database

[](#import-database)

Use `cy.importDatabase()` to import a SQL file. By default, this it will import a file located at `env('SQL_TESTING_BASE_DUMP')`, relative to the root. However, you can provide a path as the first parameter.

```
// Import `env('SQL_TESTING_BASE_DUMP')` database file.
cy.importDatabase()

// Import '/tmp/test.sql'.
cy.importDatabase('/tmp/test.sql')
```

### Create An Entity

[](#create-an-entity)

Use `cy.create('User')` to generate an entity from a configured factory. This packages expects to find [vierge-noire/cakephp-fixture-factories](https://github.com/vierge-noire/cakephp-fixture-factories) factories. Please see their documentation for creating factories.

```
cy.create('User')
```

It is possible to pass additional attributes to the factory allowing to to set default data.

For example, the following creates a User entity with the email set to `foobar@example.com`.

```
cy.create('User', { email: 'example@example.com' })
```

### Run Arbitrary Cake Command

[](#run-arbitrary-cake-command)

Post a request to `/cypress/cake` to run CakePHP commands.

```
# To get CakePHP version
cy.cake('version')

# To clear all caches
cy.cake('cache clear_all')
```

Contributing
------------

[](#contributing)

PRs, especially with tests, will be considered.

**Contributed and maintained by [tyler36](https://github.com/tyler36)**

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance66

Regular maintenance activity

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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 ~17 days

Recently: every ~8 days

Total

6

Last Release

474d ago

Major Versions

1.3.0 → v2.12025-01-20

PHP version history (2 changes)1.0PHP &gt;=8.1

1.2PHP ^7.4|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/c68f48588d57835c170cde02444307a450b98cfab07c9674094b881545c13b76?d=identicon)[tyler36](/maintainers/tyler36)

---

Top Contributors

[![tyler36](https://avatars.githubusercontent.com/u/7234392?v=4)](https://github.com/tyler36 "tyler36 (24 commits)")

---

Tags

cakephpcakephp-plugincakephp5cypresstesting

### Embed Badge

![Health badge](/badges/tyler36-cypress-cake/health.svg)

```
[![Health](https://phpackages.com/badges/tyler36-cypress-cake/health.svg)](https://phpackages.com/packages/tyler36-cypress-cake)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M678](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M753](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M571](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)

PHPackages © 2026

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