You are here

class DrushLogMigrateMessageTest 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
  2. 3.x tests/src/Unit/DrushLogMigrateMessageTest.php \Drupal\Tests\migrate_manifest\Unit\DrushLogMigrateMessageTest

Class DrushLogMigrateMessageTest

@coversDefaultClass \Drupal\migrate_manifest\DrushLogMigrateMessage

Hierarchy

Expanded class hierarchy of DrushLogMigrateMessageTest

File

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

Namespace

Drupal\Tests\migrate_manifest\Unit
View source
class DrushLogMigrateMessageTest extends TestCase {

  /**
   * @covers ::display
   */
  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.');
  }

}

Members