trait Illuminate / Foundation / Testing / Concerns / MocksApplicationServices
You are viewing an older version of the documentation. For the latest, please visit master documentation.

MocksApplicationServices

Properties

protected

$firedEvents array

All of the fired events.

Default: []
protected

$firedModelEvents array

All of the fired model events.

Default: []
protected

$dispatchedJobs array

All of the dispatched jobs.

Default: []
protected

$dispatchedNotifications array

All of the dispatched notifications.

Default: []

Methods

public

expectsEvents ( $events ) : $this

Specify a list of events that should be fired for the given operation.

Parameters

  • $events array|string
public

doesntExpectEvents ( $events ) : $this

Specify a list of events that should not be fired for the given operation.

Parameters

  • $events array|string
protected

withoutEvents ( ) : $this

Mock the event dispatcher so all events are silenced and collected.

protected

getFiredEvents ( array $events ) : array

Filter the given events against the fired events.

Parameters

  • $events array
protected

expectsJobs ( $jobs ) : $this

Specify a list of jobs that should be dispatched for the given operation.

Parameters

  • $jobs array|string
protected

doesntExpectJobs ( $jobs ) : $this

Specify a list of jobs that should not be dispatched for the given operation.

Parameters

  • $jobs array|string
protected

withoutJobs ( ) : $this

Mock the job dispatcher so all jobs are silenced and collected.

protected

getDispatchedJobs ( array $jobs ) : array

Filter the given jobs against the dispatched jobs.

Parameters

  • $jobs array
protected

getDispatched ( array $classes , array $dispatched ) : array

Filter the given classes against an array of dispatched classes.

Parameters

  • $classes array
  • $dispatched array
protected

wasDispatched ( $needle , array $haystack ) : bool

Check if the given class exists in an array of dispatched classes.

Parameters

  • $needle string
  • $haystack array
protected

withoutNotifications ( ) : $this

Mock the notification dispatcher so all notifications are silenced.

protected

expectsNotification ( $notifiable , $notification ) : $this

Specify a notification that is expected to be dispatched.

Parameters

  • $notifiable mixed
  • $notification string