Neos\Flow\Persistence\Generic\PersistenceManager::tearDown PHP Method

tearDown() public method

This method is called in functional tests to reset the storage between tests. The implementation is optional and depends on the underlying persistence backend.
public tearDown ( ) : void
return void
    public function tearDown()
    {
        if (method_exists($this->backend, 'tearDown')) {
            $this->backend->tearDown();
        }
    }

Usage Example

 /**
  * @test
  */
 public function tearDownWithBackendSupportingTearDownDelegatesCallToBackend()
 {
     $methods = array_merge(get_class_methods(Generic\Backend\BackendInterface::class), ['tearDown']);
     $mockBackend = $this->getMockBuilder(Generic\Backend\BackendInterface::class)->setMethods($methods)->getMock();
     $mockBackend->expects($this->once())->method('tearDown');
     $persistenceManager = new Generic\PersistenceManager();
     $persistenceManager->injectBackend($mockBackend);
     $persistenceManager->tearDown();
 }