Commit 4fe0b034 authored by catch's avatar catch
Browse files

Issue #3128905 by jungle, longwave, Kristen Pol, mondrake: Replace assert*...

Issue #3128905 by jungle, longwave, Kristen Pol, mondrake: Replace assert* involving an instanceof operator with assertInstanceOf()/assertNotInstanceOf()
parent be4177a9
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/action/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public function testActions() {
  protected function assertEntity($id, $label, $type, $configuration) {
    $action = Action::load($id);

    $this->assertTrue($action instanceof Action);
    $this->assertInstanceOf(Action::class, $action);
    /** @var \Drupal\system\Entity\Action $action */
    $this->assertIdentical($id, $action->id());
    $this->assertIdentical($label, $action->label());
+1 −1
Changes for core/modules/action/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public function testActions() {
  protected function assertEntity($id, $label, $type, $configuration) {
    $action = Action::load($id);

    $this->assertTrue($action instanceof Action);
    $this->assertInstanceOf(Action::class, $action);
    /** @var \Drupal\system\Entity\Action $action */
    $this->assertIdentical($id, $action->id());
    $this->assertIdentical($label, $action->label());
+4 −4
Changes for core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ protected function setUp(): void {
   * Tests CRUD operations.
   */
  public function testBlockCRUD() {
    $this->assertTrue($this->controller instanceof ConfigEntityStorage, 'The block storage is loaded.');
    $this->assertInstanceOf(ConfigEntityStorage::class, $this->controller, 'The block storage is loaded.');

    // Run each test method in the same installation.
    $this->createTests();
@@ -73,7 +73,7 @@ protected function createTests() {
    ]);
    $entity->save();

    $this->assertTrue($entity instanceof Block, 'The newly created entity is a Block.');
    $this->assertInstanceOf(Block::class, $entity, 'The newly created entity is a Block.');

    // Verify all of the block properties.
    $actual_properties = $this->config('block.block.test_block')->get();
@@ -102,7 +102,7 @@ protected function createTests() {

    $this->assertIdentical($actual_properties, $expected_properties);

    $this->assertTrue($entity->getPlugin() instanceof TestHtmlBlock, 'The entity has an instance of the correct block plugin.');
    $this->assertInstanceOf(TestHtmlBlock::class, $entity->getPlugin(), 'The entity has an instance of the correct block plugin.');
  }

  /**
@@ -111,7 +111,7 @@ protected function createTests() {
  protected function loadTests() {
    $entity = $this->controller->load('test_block');

    $this->assertTrue($entity instanceof Block, 'The loaded entity is a Block.');
    $this->assertInstanceOf(Block::class, $entity, 'The loaded entity is a Block.');

    // Verify several properties of the block.
    $this->assertSame('content', $entity->getRegion());
+2 −2
Changes for core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ protected function setUp(): void {
   */
  public function assertEntity($id, $visibility, $region, $theme, $weight, array $settings = NULL, $status = TRUE) {
    $block = Block::load($id);
    $this->assertTrue($block instanceof Block);
    $this->assertInstanceOf(Block::class, $block);
    $this->assertSame($visibility, $block->getVisibility());
    $this->assertSame($region, $block->getRegion());
    $this->assertSame($theme, $block->getTheme());
@@ -303,7 +303,7 @@ public function testBlockMigration() {

    // Custom block with php code is not migrated.
    $block = Block::load('block_3');
    $this->assertFalse($block instanceof Block);
    $this->assertNotInstanceOf(Block::class, $block);
  }

}
+1 −1
Changes for core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ protected function setUp(): void {
   */
  public function assertEntity($id, $plugin_id, array $roles, $pages, $region, $theme, $weight, $label, $label_display, $status = TRUE) {
    $block = Block::load($id);
    $this->assertTrue($block instanceof Block);
    $this->assertInstanceOf(Block::class, $block);
    /** @var \Drupal\block\BlockInterface $block */
    $this->assertSame($plugin_id, $block->getPluginId());

Loading