PHP Classes

File: specs/Spec/EventSpec.php

Recommend this page to a friend!
  Classes of Michael Cummings   PHP Event Mediator   specs/Spec/EventSpec.php   Download  
File: specs/Spec/EventSpec.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHP Event Mediator
Emit and listen to events using a mediator object
Author: By
Last change: Updated specs/Spec/Event classes' copyright and to use PHP 7.0 strict_types as well.
Date: 7 years ago
Size: 2,412 bytes
 

Contents

Class file image Download
<?php
declare(strict_types = 1);
/**
 * Contains PhpSpec EventSpec class.
 *
 * PHP version 7.0
 *
 * LICENSE:
 * This file is part of Event Mediator - A general event mediator (dispatcher)
 * which has minimal dependencies so it is easy to drop in and use.
 * Copyright (C) 2015-2016 Michael Cummings
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, you may write to
 *
 * Free Software Foundation, Inc.
 * 59 Temple Place, Suite 330
 * Boston, MA 02111-1307 USA
 *
 * or find a electronic copy at
 * <http://spdx.org/licenses/GPL-2.0.html>.
 *
 * You should also be able to find a copy of this license in the included
 * LICENSE file.
 *
 * @author Michael Cummings <mgcummings@yahoo.com>
 * @copyright 2015-2016 Michael Cummings
 * @license GPL-2.0
 */
namespace Spec\EventMediator;

use
PhpSpec\ObjectBehavior;

/**
 * Class EventSpec
 *
 * @mixin \EventMediator\Event
 *
 * @method void shouldImplement($interface)
 * @method void shouldHaveBeenHandled()
 * @method void shouldNotHaveBeenHandled()
 * @method void shouldReturn($result)
 * @method void shouldReturnAnInstanceOf()
 * @method $this shouldThrow()
 * @method void willReturn($result)
 */
class EventSpec extends ObjectBehavior
{
   
/**
     *
     */
   
public function it_is_initializable()
    {
       
$this->shouldHaveType('\\EventMediator\\Event');
       
$this->shouldImplement('\\EventMediator\\EventInterface');
    }
   
/**
     *
     */
   
public function it_provides_fluent_interface_from_event_handled()
    {
       
$this->eventHandled()
             ->
shouldReturn($this);
    }
   
/**
     *
     */
   
public function it_should_have_handled_event_after_event_handled_used()
    {
       
$this->eventHandled()
             ->
shouldHaveBeenHandled();
    }
   
/**
     *
     */
   
public function it_should_have_not_handled_event_initially()
    {
       
$this->shouldNotHaveBeenHandled();
    }
}