CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.4 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.4
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
      • Session
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Constraint
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • EventFired
  • EventFiredWith
 1: <?php
 2: namespace Cake\TestSuite\Constraint;
 3: 
 4: if (class_exists('PHPUnit_Runner_Version') && !class_exists('PHPUnit\Framework\Constraint\Constraint')) {
 5:     class_alias('PHPUnit_Framework_Constraint', 'PHPUnit\Framework\Constraint\Constraint');
 6: }
 7: if (class_exists('PHPUnit_Runner_Version') && !class_exists('PHPUnit\Framework\AssertionFailedError')) {
 8:     class_alias('PHPUnit_Framework_AssertionFailedError', 'PHPUnit\Framework\AssertionFailedError');
 9: }
10: 
11: use Cake\Event\EventManager;
12: use PHPUnit\Framework\AssertionFailedError;
13: use PHPUnit\Framework\Constraint\Constraint;
14: 
15: /**
16:  * EventFired constraint
17:  */
18: class EventFired extends Constraint
19: {
20:     /**
21:      * Array of fired events
22:      *
23:      * @var EventManager
24:      */
25:     protected $_eventManager;
26: 
27:     /**
28:      * Constructor
29:      *
30:      * @param EventManager $eventManager Event manager to check
31:      */
32:     public function __construct($eventManager)
33:     {
34:         parent::__construct();
35:         $this->_eventManager = $eventManager;
36: 
37:         if ($this->_eventManager->getEventList() === null) {
38:             throw new AssertionFailedError('The event manager you are asserting against is not configured to track events.');
39:         }
40:     }
41: 
42:     /**
43:      * Checks if event is in fired array
44:      *
45:      * @param mixed $other Constraint check
46:      * @return bool
47:      */
48:     public function matches($other)
49:     {
50:         return $this->_eventManager->getEventList()->hasEvent($other);
51:     }
52: 
53:     /**
54:      * Assertion message string
55:      *
56:      * @return string
57:      */
58:     public function toString()
59:     {
60:         return 'was fired';
61:     }
62: }
63: 
Follow @CakePHP
#IRC
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs