Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->configFactory = $this->getMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
     $this->configManager = $this->getMock('Drupal\\Core\\Config\\ConfigManagerInterface');
     $this->configManager->expects($this->any())->method('getEntityTypeIdByName')->will($this->returnArgument(0));
     vfsStream::setup('public://');
 }
Пример #2
0
 /**
  * @covers ::delete
  * @covers ::doDelete
  */
 public function testDelete()
 {
     // Dependencies are tested in
     // \Drupal\Tests\config\Kernel\ConfigDependencyTest.
     $this->configManager->expects($this->any())->method('getConfigEntitiesToChangeOnDependencyRemoval')->willReturn(['update' => [], 'delete' => [], 'unchanged' => []]);
     $entities = array();
     $configs = array();
     $config_map = array();
     foreach (array('foo', 'bar') as $id) {
         $entity = $this->getMockEntity(array('id' => $id));
         $entities[] = $entity;
         $config_object = $this->getMockBuilder('Drupal\\Core\\Config\\Config')->disableOriginalConstructor()->getMock();
         $config_object->expects($this->once())->method('delete');
         $configs[] = $config_object;
         $config_map[] = array("the_config_prefix.{$id}", $config_object);
     }
     $this->cacheTagsInvalidator->expects($this->once())->method('invalidateTags')->with(array($this->entityTypeId . '_list'));
     $this->configFactory->expects($this->exactly(2))->method('getEditable')->will($this->returnValueMap($config_map));
     $this->moduleHandler->expects($this->at(0))->method('invokeAll')->with('test_entity_type_predelete');
     $this->moduleHandler->expects($this->at(1))->method('invokeAll')->with('entity_predelete');
     $this->moduleHandler->expects($this->at(2))->method('invokeAll')->with('test_entity_type_predelete');
     $this->moduleHandler->expects($this->at(3))->method('invokeAll')->with('entity_predelete');
     $this->moduleHandler->expects($this->at(4))->method('invokeAll')->with('test_entity_type_delete');
     $this->moduleHandler->expects($this->at(5))->method('invokeAll')->with('entity_delete');
     $this->moduleHandler->expects($this->at(6))->method('invokeAll')->with('test_entity_type_delete');
     $this->moduleHandler->expects($this->at(7))->method('invokeAll')->with('entity_delete');
     $this->entityStorage->delete($entities);
 }