loadEntity() public method

public loadEntity ( $id, $parentId = null )
コード例 #1
0
 /**
  * @test
  */
 public function parentEntityDoesNotContainReferenceAfterItsDeleted()
 {
     $parent = ['vp_id' => '927D63C187164CA1BCEAB2B13B29C8F0', 'some_field' => 'some_value'];
     $mnReference = ['vp_some_entity' => '927D63C187164CA1BCEAB2B13B29C8F0', 'vp_other_entity' => 'F0E1B6313B7A48E49A1B38DF382B350D'];
     $this->parentStorage->save($parent);
     $this->storage->save($mnReference);
     $this->storage->delete($mnReference);
     $loadedParent = $this->parentStorage->loadEntity($mnReference['vp_some_entity']);
     $this->assertArrayNotHasKey('vp_other_entity', $loadedParent);
 }
コード例 #2
0
 /**
  * @test
  * @testdox Synchronizer replaces value references
  */
 public function synchronizerReplacesValueReferences()
 {
     $post = EntityUtils::preparePost();
     $optionToSynchronize = [['vp_id' => 'site_icon', 'parent' => null]];
     $postToSynchronize = [['vp_id' => $post['vp_id'], 'parent' => null]];
     $previousSiteIcon = $this->storage->exists('site_icon') ? $this->storage->loadEntity('site_icon') : '';
     $this->postStorage->save($post);
     $option = EntityUtils::prepareOption('site_icon', $post['vp_id']);
     $this->storage->save($option);
     $this->postsSynchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $postToSynchronize);
     $this->synchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $optionToSynchronize);
     DBAsserter::assertFilesEqualDatabase();
     // cleanup
     if ($previousSiteIcon) {
         if (!isset($previousSiteIcon['option_value'])) {
             $previousSiteIcon['option_value'] = false;
         }
         $this->storage->save($previousSiteIcon);
     } else {
         $this->storage->delete($option);
     }
     $this->postStorage->delete($post);
     $this->synchronizer->reset();
     $this->postsSynchronizer->reset();
     $this->synchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $optionToSynchronize);
     $this->postsSynchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $postToSynchronize);
 }
コード例 #3
0
 /**
  * Test covers part of for WP-428
  *
  * @test
  */
 public function vpidShouldBeReplaceableWithZero()
 {
     $updatedEntity = $this->testingEntity;
     $updatedEntity['vp_comment_post_ID'] = 0;
     $this->storage->save($this->testingEntity);
     $this->storage->save($updatedEntity);
     $loadedOption = $this->storage->loadEntity($updatedEntity['vp_id']);
     $this->assertEquals($updatedEntity, $loadedOption);
 }