Location: PHPKode > projects > TeamSpeak3 ChannelWatcher > devMX-TeamSpeak3-ChannelWatcher-f5257dd/tests/src/devmx/ChannelWatcher/Rule/AccessControlerBasedRuleTest.php
<?php

namespace devmx\ChannelWatcher\Rule;

require_once dirname( __FILE__ ) . '/../../../../../src/devmx/ChannelWatcher/Rule/AccessControlerBasedRule.php';

/**
 * Test class for AccessControlerBasedRule.
 * Generated by PHPUnit on 2012-05-21 at 21:02:58.
 */
class AccessControlerBasedRuleTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @covers devmx\ChannelWatcher\Rule\AccessControlerBasedRule::filter
     */
    public function testFilter()
    {
        $c1 = array('cid'=>1, '__delete' => true);
        $c2 = array('cid'=>2, '__delete' => true);
        $valueMap = array(
            array(1, true),
            array(2, false)
        );
        $toFilter = array(1=>$c1, 2=>$c2);
        $expected = $toFilter;
        $expected[2]['__delete'] = false;
        $controler = $this->getMockForAbstractClass('\devmx\ChannelWatcher\AccessControl\AccessControlerInterface');
        $controler->expects($this->exactly(2))
                  ->method('canAccess')
                  ->will($this->returnValueMap($valueMap));
        $rule = new AccessControlerBasedRule($controler);
        $this->assertEquals($expected, $rule->filter($toFilter));
    }

}

?>
Return current item: TeamSpeak3 ChannelWatcher