Download the PHP package khalyomede/matcha without Composer
On this page you can find all versions of the php package khalyomede/matcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download khalyomede/matcha
More information about khalyomede/matcha
Files in khalyomede/matcha
Informations about the package matcha
Matcha
Unit test library that taste good.
Summary
- Installation
- Examples
- Full example
- API
- Credits
Installation
In your project root folder:
Examples
- Example 1: testing if a code returns a string
- Example 2: testing if a value is true
- Example 3: testing if a code returns null
- Example 4: testing the negativity of an expression
- Example 5: testing if a message has been displayed
- Example 6: testing if a variable returns the desired type
- Example 7: testing against a string format
- Example 8: testing if a database is reachable
- Example 9: make the console report detailed
- Example 10: using matcha console command on a single file
- Example 11: using matcha console command on a folder
Example 1: testing if a code returns a string
Example 2: testing if a value is true
Example 3: testing if a code returns false
Example 4: testing the negativity of an expression
Example 5: testing if a message has been displayed
Example 6: testing if a variable returns the desired type
Example 7: testing against a string format
Example 8: testing if a database is reachable
Example 9: make the console report detailed
Example 10: using matcha console command on a single file
Example 11: using matcha console command on a folder
Check /example/tests, all the files that ends with .php
. You are not constraint by the extension .test.php
, you can ommit it.
Full example
This example is intended to show you how can all of these function can be mixed together.
API
- describe
- expect
- not
- strictly
- toBe
- aBoolean
- aDatabase
- thatIsAccessible
- aDouble
- aFile
- aFloat
- aFunction
- anArray
- anObject
- anInstanceOf
- anInteger
- aResource
- aString
- inJsonFormat
- equalTo
- false
- null
- true
- toDisplay
- toThrow
- theException
- theMessage
- it
- report
- run
expect
Returns a new Expect instance.
not
Asserts that we expect the inverse of the test.
strictly
Asserts that we expect the test to be also type-tested (this will prevent from PHP to perform implicit cast when running the test).
toBe
Asserts that we are testing an equality.
equalTo
Asserts that we are testing an equality against a particular value.
Report
Update the level of report in console.
Available reports levels are detailed
, normal
(by default) and reduced
.
Reports levels can be used through Khalyomede\ReportLevel
class:
Credits
- Logo by Made from Noun project (modified version of logo is currenctly used, check out the original version)