You are here

public function EnsureSubscriberTest::testLoggingHappens in Flysystem 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/EventSubscriber/EnsureSubscriberTest.php \Drupal\Tests\flysystem\Unit\EventSubscriber\EnsureSubscriberTest::testLoggingHappens()
  2. 3.x tests/src/Unit/EventSubscriber/EnsureSubscriberTest.php \Drupal\Tests\flysystem\Unit\EventSubscriber\EnsureSubscriberTest::testLoggingHappens()
  3. 3.0.x tests/src/Unit/EventSubscriber/EnsureSubscriberTest.php \Drupal\Tests\flysystem\Unit\EventSubscriber\EnsureSubscriberTest::testLoggingHappens()

Tests that the event subscriber logs ensure() calls.

File

tests/src/Unit/EventSubscriber/EnsureSubscriberTest.php, line 23

Class

EnsureSubscriberTest
@coversDefaultClass \Drupal\flysystem\EventSubscriber\EnsureSubscriber @covers \Drupal\flysystem\EventSubscriber\EnsureSubscriber

Namespace

Drupal\Tests\flysystem\Unit\EventSubscriber

Code

public function testLoggingHappens() {
  $logger = $this
    ->prophesize(LoggerInterface::class);
  $dispatcher = $this
    ->createMock(EventDispatcherInterface::class);
  $logger
    ->log('severity', 'message', [
    'context',
  ])
    ->shouldBeCalled();
  $event = new EnsureEvent('scheme', 'severity', 'message', [
    'context',
  ]);
  $subscriber = new EnsureSubscriber($logger
    ->reveal());
  $subscriber
    ->onEnsure($event, FlysystemEvents::ENSURE, $dispatcher);
}