Download the PHP package jippi/cakephp-test-utilities without Composer
On this page you can find all versions of the php package jippi/cakephp-test-utilities. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jippi/cakephp-test-utilities
More information about jippi/cakephp-test-utilities
Files in jippi/cakephp-test-utilities
Package cakephp-test-utilities
Short Description Package with support traits to ease unit testing.
License MIT
Homepage https://github.com/friendsofcake/cakephp-test-utilities
Informations about the package cakephp-test-utilities
Test utilities
This package contains support traits to ease unit testing.
Installing via composer
You should install this package into your project using composer. To do so you can run the following command:
Traits
At this point there are two traits:
AccessibilityHelperTrait
: Gain access protected properties and methods.CompareTrait
: Assert methods, comparing to files for: HTML, JSON, XML
AccessibilityHelperTrait
This trait gains you access to protected properties and methods. You don't need of a new class with pass-through methods. It uses reflection to achieve this.
Setup
Add the trait at the top of your test case:
Now that you have the trait you need to set which object you want to access.
You can do this globally for the entire test in setUp()
or in your test
methods:
Protected properties
You can get and set the protected properties:
Protected methods
You can directly call protected methods:
CompareTrait
This trait helps with comparing test results as string
Setup
Add the trait at the top of your test case and define the _compareBasePath
property so the trait knows where to look for comparison files:
Usage
Each of the methods acts similar to the core assertSameAsFile
method:
See Cake's docs
for more details on usage of assertSameAsFile
on which these methods are
based.