Crud\TestCase\Controller\Crud\CrudComponentTest::testRemoveListener PHP Method

testRemoveListener() public method

Test that removeListener works
public testRemoveListener ( ) : void
return void
    public function testRemoveListener()
    {
        $this->Crud->addListener('api', 'Crud.Api');
        $listeners = $this->Crud->config('listeners');
        $expected = ['api' => ['className' => 'Crud.Api']];
        $this->assertEquals($expected, $listeners);
        $this->Crud->removeListener('api');
        $listeners = $this->Crud->config('listeners');
        $this->assertEquals([], $listeners);
        // Should now throw an exception
        $this->setExpectedException('Exception', 'Listener "api" is not configured');
        $this->Crud->listener('api');
    }