Mercurial > hg > isophonics-drupal-site
comparison core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests\block\Unit; | 3 namespace Drupal\Tests\block\Unit; |
4 | 4 |
5 use Drupal\Core\DependencyInjection\ContainerBuilder; | 5 use Drupal\Core\DependencyInjection\ContainerBuilder; |
6 use Drupal\Core\Entity\EntityTypeManagerInterface; | |
6 use Drupal\Tests\Core\Plugin\Fixtures\TestConfigurablePlugin; | 7 use Drupal\Tests\Core\Plugin\Fixtures\TestConfigurablePlugin; |
7 use Drupal\Tests\UnitTestCase; | 8 use Drupal\Tests\UnitTestCase; |
8 | 9 |
9 /** | 10 /** |
10 * @coversDefaultClass \Drupal\block\Entity\Block | 11 * @coversDefaultClass \Drupal\block\Entity\Block |
18 * @var \Drupal\Core\Entity\EntityTypeInterface|\PHPUnit_Framework_MockObject_MockObject | 19 * @var \Drupal\Core\Entity\EntityTypeInterface|\PHPUnit_Framework_MockObject_MockObject |
19 */ | 20 */ |
20 protected $entityType; | 21 protected $entityType; |
21 | 22 |
22 /** | 23 /** |
23 * The entity manager used for testing. | 24 * The entity type manager used for testing. |
24 * | 25 * |
25 * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject | 26 * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject |
26 */ | 27 */ |
27 protected $entityManager; | 28 protected $entityTypeManager; |
28 | 29 |
29 /** | 30 /** |
30 * The ID of the type of the entity under test. | 31 * The ID of the type of the entity under test. |
31 * | 32 * |
32 * @var string | 33 * @var string |
49 $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface'); | 50 $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface'); |
50 $this->entityType->expects($this->any()) | 51 $this->entityType->expects($this->any()) |
51 ->method('getProvider') | 52 ->method('getProvider') |
52 ->will($this->returnValue('block')); | 53 ->will($this->returnValue('block')); |
53 | 54 |
54 $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface'); | 55 $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); |
55 $this->entityManager->expects($this->any()) | 56 $this->entityTypeManager->expects($this->any()) |
56 ->method('getDefinition') | 57 ->method('getDefinition') |
57 ->with($this->entityTypeId) | 58 ->with($this->entityTypeId) |
58 ->will($this->returnValue($this->entityType)); | 59 ->will($this->returnValue($this->entityType)); |
59 | 60 |
60 $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface'); | 61 $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface'); |
61 | 62 |
62 $container = new ContainerBuilder(); | 63 $container = new ContainerBuilder(); |
63 $container->set('entity.manager', $this->entityManager); | 64 $container->set('entity_type.manager', $this->entityTypeManager); |
64 $container->set('uuid', $this->uuid); | 65 $container->set('uuid', $this->uuid); |
65 \Drupal::setContainer($container); | 66 \Drupal::setContainer($container); |
66 } | 67 } |
67 | 68 |
68 /** | 69 /** |