Download the PHP package tyler36/phpunit-helper-traits without Composer
On this page you can find all versions of the php package tyler36/phpunit-helper-traits. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tyler36/phpunit-helper-traits
More information about tyler36/phpunit-helper-traits
Files in tyler36/phpunit-helper-traits
Package phpunit-helper-traits
Short Description Additional phpunit traits to complement Laravel testing
License
Informations about the package phpunit-helper-traits
``# PHPUnit Traits
Installation
1.Install package through composer.
Intro
These traits were designed and tested with Laravel 5.2, with Laravel-elixir 5. Using laravel-elixir's 'visit' command will test a page is available and generate a crawler object used for some of the tests. Check the tests directory for further examples and uses.
CheckAssetExistsTrait
Check if item/s are available, and also appears on the page. If the string starts with 'http', this trait will make a HTTP request to the web and check if the asset is available. Usefully for checking CDNs. Other paths will begin looking in the projects 'public' directory ("app()->publicPath()"). If the tests has a crawler object, this trait will also check if the string is displayed on the page.
*Returns TEST case to allow chaining.
USE: Include trait within class -
Call trait with filename or array -
EG.
CountElementsTrait
Check page and counts occurrence of specified CSS selector.
USE: Include trait within class -
Call trait with CSS selector and expected count -
EG.
DisableExceptionHandlerTrait
This trait overwrites the default exception handler, allowing you to check error messages with assertions.
USE: Include trait within class -
Call trait with CSS selector to disable exception handling -
Use TRY / CATCH in test.
ImpersonateTrait
Helper for setting authenticated state.
asGuest
Ensure current status is guest (logged out).
USE: Include trait within class -
EG.
asMember
Ensure current status is member (logged out). If a user object is passed, this trait will login as that user. If no user object is passed, this trait will use a 'App\User' factory to create a random User object and log in.
USE: Include trait within class -
EG.
MailTrackingTrait
Inspired by phpunit-testing-in-laravel Check mail options by intercepting sent mails. You may want to prevent laravel from sending mail by using the log driver; in a test or setUp() function
USE: Include trait within class -
seeEmailWasNotSent
ASSERT: Mail was NOT sent
seeEmailWasSent
ASSERT: Mail was sent
seeEmailsSent($count)
ASSERT: $count number of emails were sent
seeEmailTo($recipient)
ASSERT: Recipient
seeEmailNotTo($recipient)
ASSERT: NOT Recipient
seeEmailFrom($sender)
ASSERT: Sender
seeEmailNotFrom($sender)
ASSERT: NOT Sender
seeEmailEquals($body)
ASSERT: Body Matches
seeEmailNotEquals($body)
ASSERT: Body NOT Matches
seeEmailContains($excerpt)
ASSERT: Body contains fragment
seeEmailNotContains($excerpt)
ASSERT: Body NOT contains fragment
seeEmailSubjectEquals($subject)
ASSERT: Subject Matches
seeEmailSubjectNotEquals($subject)
ASSERT: Subject NOT Matches
seeEmailSubjectContains($excerpt)
ASSERT: Subject contains
seeEmailSubjectNotContains($excerpt)
ASSERT: Subject NOT contains
PrepareFileUploadTrait
Simulate a file upload
Include trait within class -
Call trait with filename or array -
EG.