You are here

public function DrushLogMigrateMessageTest::testDisplay in Migrate Manifest 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/DrushLogMigrateMessageTest.php \Drupal\Tests\migrate_manifest\Unit\DrushLogMigrateMessageTest::testDisplay()
  2. 3.x tests/src/Unit/DrushLogMigrateMessageTest.php \Drupal\Tests\migrate_manifest\Unit\DrushLogMigrateMessageTest::testDisplay()

@covers ::display

File

tests/src/Unit/DrushLogMigrateMessageTest.php, line 20

Class

DrushLogMigrateMessageTest
Class DrushLogMigrateMessageTest

Namespace

Drupal\Tests\migrate_manifest\Unit

Code

public function testDisplay() {
  $logger = new TestLogger();
  $migrate_message = new DrushLogMigrateMessage($logger);
  $migrate_message
    ->display('my message');
  $this
    ->assertTrue($logger
    ->hasRecord('my message', 'info'), 'status logged correctly');
  $migrate_message
    ->display('my error', 'error');
  $this
    ->assertTrue($logger
    ->hasRecord('my error', 'error'), 'error logged correctly');
  $migrate_message
    ->display('my broken message', 'broken');
  $this
    ->assertTrue($logger
    ->hasRecord('my broken message', 'info'), 'broken type handled');
  $this
    ->assertTrue($logger
    ->hasRecord([
    'message' => 'Logger called with unknown type: @type',
    'context' => [
      '@type' => 'broken',
    ],
  ], 'warning'), 'broken warning logged.');
}