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

namespace devmx\ChannelWatcher\AccessControl;


/**
 * Test class for ControlList.
 * Generated by PHPUnit on 2012-01-29 at 15:14:21.
 */
class ControlListTest extends \PHPUnit_Framework_TestCase
{
    
    
    /**
     * @covers devmx\ChannelWatcher\AccessControl\ListBasedControler::canAccess
     * @dataProvider listProvider
     */
    public function testCanAccess($blacklist, $whitelist, $trueItems, $falseItems)
    {
        $list = new ListBasedControler($blacklist, $whitelist);
        foreach($trueItems as $item) {
            $this->assertTrue($list->canAccess($item));
        }
        foreach($falseItems as $item) {
            $this->assertFalse($list->canAccess($item));
        }
    }
    
    public function listProvider() {
        return array(
          array(array('foo', 'bar'), null, array('asdf', 'jklö'), array('foo', 'bar')),
          array(array('foo', 'bar'), array('asdf', 'jklö'), array('asdf', 'jklö'), array('foo', 'bar', 'sdfsd', 'asdd')),
          array(array('a', 'b'), array('a', 'b'), array(), array('a', 'b', 'c', 'd'))
        );
    }
    
    

}

?>
Return current item: TeamSpeak3 ChannelWatcher