PHP Classes

File: tests/Wingu/OctopusCore/EventDispatcher/Tests/Unit/EventNameMatcher/AllNamesMatcherTest.php

Recommend this page to a friend!
  Classes of Protung Dragos   PHP Event Dispatcher   tests/Wingu/OctopusCore/EventDispatcher/Tests/Unit/EventNameMatcher/AllNamesMatcherTest.php   Download  
File: tests/Wingu/OctopusCore/EventDispatcher/Tests/Unit/EventNameMatcher/AllNamesMatcherTest.php
Role: Unit test script
Content type: text/plain
Description:
Class: PHP Event Dispatcher
Register events and call registered listeners
Author: By
Last change: Initial commit
Date: 2 years ago
Size: 1,217 bytes
 

Contents

Class file image Download
<?php

namespace Wingu\OctopusCore\EventDispatcher\Tests\Unit\EventNameMatcher;

use
Wingu\OctopusCore\EventDispatcher\Tests\Unit\TestCase;
use
Wingu\OctopusCore\EventDispatcher\EventNameMatcher\AllNamesMatcher;

class
AllNamesMatcherTest extends TestCase {

    protected function
getEventMock() {
        return
$this->getMock('\Wingu\OctopusCore\EventDispatcher\EventInterface');
    }

    public function
getDataMatch() {
        return array(
            [
'myevent'], ['MYEVENT'], ['system.log'], ['system.*.log'],
            [
true], [false], [null], [new \stdClass()], [array(1,2,3)], [654321],
        );
    }

   
/**
     * @dataProvider getDataMatch
     */
   
public function testMatch($event) {
       
$event = $this->getEventMock();
       
$matcher = new AllNamesMatcher();
       
$this->assertTrue($matcher->match($event));
    }

   
/**
     * @dataProvider getDataMatch
     */
   
public function testMatchByName($eventName) {
       
$matcher = new AllNamesMatcher();
       
$this->assertTrue($matcher->matchByName($eventName));
    }

    public function
testGetHash() {
       
$matcher = new AllNamesMatcher();
       
$this->assertSame(get_class($matcher), $matcher->getHash());
    }
}