public function testDeleteContent() { $app = $this->getApp(); $app['request'] = Request::create('/'); $storage = new Storage($app); // Test delete fails on missing params $this->setExpectedException('Bolt\\Exception\\StorageException', 'Contenttype is required for deleteContent'); $this->assertFalse($storage->deleteContent('', 999)); $content = $storage->getContent('showcases/1'); // Test the delete events are triggered $delete = 0; $listener = function () use(&$delete) { $delete++; }; $app['dispatcher']->addListener(StorageEvents::PRE_DELETE, $listener); $app['dispatcher']->addListener(StorageEvents::POST_DELETE, $listener); $storage->deleteContent(['slug' => 'showcases'], 1); $this->assertFalse($storage->getContent('showcases/1')); $this->assertEquals(2, $delete); }