getBlockMockWithMachineName example

return $block;
  }

  /** * Tests the unique machine name generator. * * @see \Drupal\block\BlockForm::getUniqueMachineName() */
  public function testGetUniqueMachineName() {
    $blocks = [];

    $blocks['test'] = $this->getBlockMockWithMachineName('test');
    $blocks['other_test'] = $this->getBlockMockWithMachineName('other_test');
    $blocks['other_test_1'] = $this->getBlockMockWithMachineName('other_test');
    $blocks['other_test_2'] = $this->getBlockMockWithMachineName('other_test');

    $query = $this->createMock('Drupal\Core\Entity\Query\QueryInterface');
    $query->expects($this->exactly(5))
      ->method('condition')
      ->willReturn($query);

    $query->expects($this->exactly(5))
      ->method('execute')
      
Home | Imprint | This part of the site doesn't use cookies.