Download the PHP package fr3nch13/cakephp-pta without Composer
On this page you can find all versions of the php package fr3nch13/cakephp-pta. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fr3nch13/cakephp-pta
More information about fr3nch13/cakephp-pta
Files in fr3nch13/cakephp-pta
Package cakephp-pta
Short Description A CakePHP Plugin to emulate a generic App when testing Plugins.
License MIT
Homepage https://github.com/fr3nch13/cakephp-pta
Informations about the package cakephp-pta
CakePHP Test App Plugin
This CakePHP Plugin is used to emulate a generic App when testing your CakePHP Plugins.
I am using the cakephp/app as that is the up-to-date skeleton app, and many of my plugins share many of the same things. This plugin is meant to keep them dry.
As an example: the test/bootstrap.php file. When I need to change/add something to that, I have to do
it in over 10 CakePHP plugins. It's easier to just put the common stuff in here, and include the tests/plugin_bootstrap.php from here. Similar to how baked plugins do with the core test/bootstrap.php.
Installation
To use this plugin's bootstrap for other plugins, add the below lines to your tests/bootstrap.php near the bottom.
Usage
You no longer need to copy the tests/test_app from this project to yours.
Instead there are other ways to inject you settings/plugin/etc into this plugin's test application:
Adding your plugin
To add your plugin to the test application, you need to update your test/bootstrap.php like so:
Adding your variables from a .env
In this plugin's tests/plugin_bootstrap.php file, it will look for your .env or .env.test files in 2 places within your plugin:
- At:
tests/.envortests/.env.test - At:
config/.envorconfig/.env.test
See the file tests/.env.example as an example.
If you need to import your variables before including the plugin_bootstrap.php like above, then you can do this:
Database settings.
This plugin uses sqlite in memory be default, but if you want to define your own database setting you can do so in your tests/bootstrap.php file, before including the plugin_bootstrap.php file as the database connection is setup in the plugin_bootstrap.php file.
Adding Migrations.
You can also define your migrations in your bootstrap.php file. This uses the Migrations\TestSuite\Migrator tool from cakephp/migrations.
The migrations get ran in the tests/plugin_bootstrap.php file near the bottom.
Adding Html Helpers
If you have View/Helpers that you would also like to include, you can define them in your bootstrap.php file as well.
These get included in tests/test_app/src/View/AppView.php
Adding Middleware
You can also define which middlewhere you would like to include.
These get included in tests/test_app/src/Application.php in the middleware() method.
Full tests/bootstrap.php example for your plugin:
Version compatibility
The major versions are locked to the major versions of CakePHP.
- PTA 1.x is locked to CakePHP ^3.8
- PTA 2.x is locked to CakePHP ^4.0 and requires php 7.3 or higher.
All versions of cakephp-pta with dependencies
cakephp/bake Version ^2.8
cakephp/cakephp Version ~4.4.8
cakephp/cakephp-codesniffer Version ~4.6
cakephp/debug_kit Version ~4.9
cakephp/migrations Version ~3.6
cakephp/plugin-installer Version ~1.3
dereuromark/cakephp-ide-helper Version ^1.18
mobiledetect/mobiledetectlib Version ^2.8
mockery/mockery Version ^1.5
phpcompatibility/php-compatibility Version ^9.3
phpstan/phpstan Version ^1.9
phpunit/phpunit Version ^9.5
staabm/annotate-pull-request-from-checkstyle Version ^1.8
symfony/dotenv Version ~5.0||~6.0
vishnubob/wait-for-it Version dev-master