public function testReferenceOneDifferentTargetDocuments() { $ref1 = new RefType1TestObj(); $ref1->id = '/functional/ref1'; $ref1->name = 'Ref1'; $ref2 = new RefType2TestObj(); $ref2->id = '/functional/ref2'; $ref2->name = 'Ref2'; $this->dm->persist($ref1); $this->dm->persist($ref2); $referer1 = new ReferenceOneObj(); $referer1->id = '/functional/referer1'; $referer1->reference = $ref1; $this->dm->persist($referer1); $referer2 = new ReferenceOneObj(); $referer2->id = '/functional/referer2'; $referer2->reference = $ref2; $this->dm->persist($referer2); $this->dm->flush(); $this->dm->clear(); $referer = $this->dm->find('Doctrine\\Tests\\ODM\\PHPCR\\Functional\\ReferenceOneObj', '/functional/referer1'); $this->assertTrue($referer->reference instanceof RefType1TestObj); $referer = $this->dm->find('Doctrine\\Tests\\ODM\\PHPCR\\Functional\\ReferenceOneObj', '/functional/referer2'); $this->assertTrue($referer->reference instanceof RefType2TestObj); }
/** * Load meta object by provided type and parameters. * * @MetaLoaderDoc( * description="Article Loader loads articles from Content Repository", * parameters={ * contentPath="SINGLE|required content path", * slug="SINGLE|required content slug", * pageName="COLLECTiON|name of Page for required articles" * } * ) * * @param string $type object type * @param array $parameters parameters needed to load required object type * @param int $responseType response type: single meta (LoaderInterface::SINGLE) or collection of metas (LoaderInterface::COLLECTION) * * @return Meta|Meta[]|bool false if meta cannot be loaded, a Meta instance otherwise */ public function load($type, $parameters, $responseType = LoaderInterface::SINGLE) { $article = null; if (empty($parameters)) { $parameters = []; } if ($responseType === LoaderInterface::SINGLE) { if (array_key_exists('contentPath', $parameters)) { $article = $this->dm->find('SWP\\ContentBundle\\Document\\Article', $parameters['contentPath']); } elseif (array_key_exists('slug', $parameters)) { $article = $this->dm->getRepository('SWP\\ContentBundle\\Document\\Article')->findOneBy(array('slug' => $parameters['slug'])); } if (!is_null($article)) { return new Meta($this->rootDir . '/Resources/meta/article.yml', $article); } } elseif ($responseType === LoaderInterface::COLLECTION) { if (array_key_exists('pageName', $parameters)) { $page = $this->em->getRepository('SWP\\ContentBundle\\Model\\Page')->getByName($parameters['pageName'])->getOneOrNullResult(); if ($page) { $articlePages = $this->em->getRepository('SWP\\ContentBundle\\Model\\PageContent')->getForPage($page)->getResult(); $articles = []; foreach ($articlePages as $articlePage) { $article = $this->dm->find('SWP\\ContentBundle\\Document\\Article', $articlePage->getContentPath()); if (!is_null($article)) { $articles[] = new Meta($this->rootDir . '/Resources/meta/article.yml', $article); } } return $articles; } } } return false; }
public function testMenuNode() { $data = array('name' => 'test-node', 'label' => 'label_foobar', 'uri' => 'http://www.example.com/foo', 'route' => 'foo_route', 'linkType' => 'route', 'content' => $this->content, 'publishable' => false, 'publishStartDate' => new \DateTime('2013-06-18'), 'publishEndDate' => new \DateTime('2013-06-18'), 'attributes' => array('attr_foobar_1' => 'barfoo', 'attr_foobar_2' => 'barfoo'), 'childrenAttributes' => array('child_foobar_1' => 'barfoo', 'child_foobar_2' => 'barfoo'), 'linkAttributes' => array('link_foobar_1' => 'barfoo', 'link_foobar_2' => 'barfoo'), 'labelAttributes' => array('label_foobar_1' => 'barfoo', 'label_foobar_2' => 'barfoo'), 'extras' => array('extra_foobar_1' => 'barfoo', 'extra_foobar_2' => 'barfoo'), 'routeParameters' => array('route_param_foobar_1' => 'barfoo', 'route_param_foobar_2' => 'barfoo'), 'routeAbsolute' => true, 'display' => false, 'displayChildren' => false); $startDateString = $data['publishStartDate']->format('Y-m-d'); $endDateString = $data['publishEndDate']->format('Y-m-d'); $menuNode = new MenuNode(); $refl = new \ReflectionClass($menuNode); $menuNode->setParentDocument($this->rootDocument); foreach ($data as $key => $value) { $refl = new \ReflectionClass($menuNode); $prop = $refl->getProperty($key); $prop->setAccessible(true); $prop->setValue($menuNode, $value); } $menuNode->addChild($this->child1); $this->dm->persist($menuNode); $this->dm->flush(); $this->dm->clear(); $menuNode = $this->dm->find(null, '/test/test-node'); $this->assertNotNull($menuNode); foreach ($data as $key => $value) { $prop = $refl->getProperty($key); $prop->setAccessible(true); $v = $prop->getValue($menuNode); if (!is_object($value)) { $this->assertEquals($value, $v); } } // test objects $prop = $refl->getProperty('content'); $prop->setAccessible(true); $content = $prop->getValue($menuNode); $this->assertEquals('fake_weak_content', $content->getName()); // test children $this->assertCount(1, $menuNode->getChildren()); // test publish start and end $publishStartDate = $menuNode->getPublishStartDate(); $publishEndDate = $menuNode->getPublishEndDate(); $this->assertInstanceOf('\\DateTime', $publishStartDate); $this->assertInstanceOf('\\DateTime', $publishEndDate); $this->assertEquals($startDateString, $publishStartDate->format('Y-m-d')); $this->assertEquals($endDateString, $publishEndDate->format('Y-m-d')); // test multi-lang $menuNode->setLocale('fr'); $this->dm->persist($menuNode); $this->dm->flush(); $this->dm->clear(); $menuNode = $this->dm->findTranslation(null, '/test/test-node', 'fr'); $this->assertEquals('fr', $menuNode->getLocale()); $child = $this->dm->find(null, '/test/test-node/child1'); $menuNode = $child->getParent(); $this->assertCount(1, $menuNode->getChildren()); $menuNode->removeChild($child); $this->dm->flush(); $this->dm->clear(); $menuNode = $this->dm->find(null, '/test/test-node'); $this->assertCount(0, $menuNode->getChildren()); }
public function setUp() { $this->db('PHPCR')->loadFixtures(array('Doctrine\\Bundle\\PHPCRBundle\\Tests\\Resources\\DataFixtures\\PHPCR\\LoadData')); $this->dm = $this->db('PHPCR')->getOm(); $document = $this->dm->find(null, '/test/doc'); $this->assertNotNull($document, 'fixture loading not working'); $this->referrer = $this->dm->find(null, '/test/ref'); $this->assertNotNull($this->referrer, 'fixture loading not working'); }
public function setUp() { $this->legacy = !method_exists('Symfony\\Component\\Form\\AbstractType', 'getBlockPrefix'); $this->db('PHPCR')->loadFixtures(array('Doctrine\\Bundle\\PHPCRBundle\\Tests\\Resources\\DataFixtures\\PHPCR\\LoadData')); $this->dm = $this->db('PHPCR')->getOm(); $document = $this->dm->find(null, '/test/doc'); $this->assertNotNull($document, 'fixture loading not working'); $this->referrer = $this->dm->find(null, '/test/ref'); $this->assertNotNull($this->referrer, 'fixture loading not working'); }
public function testMigrator() { $this->migrator->migrate('/test/page'); $this->migrator->migrate('/test/page/foo'); $res = $this->dm->find(null, '/test/page'); $this->assertNotNull($res); $this->assertEquals('Test', $res->getTitle()); $res = $this->dm->find(null, '/test/page/foo'); $this->assertNotNull($res); $this->assertEquals('Foobar', $res->getTitle()); }
/** * {@inheritdoc} */ public function reverseTransform($id) { if ($id === null) { return; } $document = $this->manager->find(null, $id); if ($document === null) { throw new TransformationFailedException(sprintf("An document with id: %s does not exist", $id)); } return $document; }
public function setUp() { $this->fetchDbParameters(); $this->connection = DriverManager::getConnection($this->params); $this->createEntityManager(); $this->createDocumentManager(); $this->resetFunctionalNode($this->dm); $this->createObjectAdapterManager(); NodeHelper::createPath($this->dm->getPhpcrSession(), '/functional'); $this->base = $this->dm->find(null, '/functional'); $this->createBaseTables(); }
public function testCreatedDate() { $parent = new FileTestObj(); $parent->file = new File(); $parent->id = '/functional/filetest'; $parent->file->setFileContentFromFilesystem(dirname(__FILE__) . '/_files/foo.txt'); $this->dm->persist($parent); $this->dm->flush(); $this->dm->clear(); $file = $this->dm->find('Doctrine\\ODM\\PHPCR\\Document\\File', '/functional/filetest/file'); $this->assertNotNull($file); $this->assertNotNull($file->getCreated()); }
public function setUp() { $this->db('PHPCR')->createTestNode(); $this->dm = $this->db('PHPCR')->getOm(); $this->base = $this->dm->find(null, '/test'); $this->db('PHPCR')->loadFixtures(array('Symfony\\Cmf\\Bundle\\SeoBundle\\Tests\\Resources\\DataFixtures\\Phpcr\\LoadSitemapData')); $this->logger = $this->getMock('Psr\\Log\\LoggerInterface'); $this->presentation = $this->getMockBuilder('\\Symfony\\Cmf\\Bundle\\SeoBundle\\SeoPresentation')->disableOriginalConstructor()->getMock(); $this->provider = new SitemapUrlInformationProvider($this->dm, $this->getContainer()->get('router'), 'always', $this->logger, $this->presentation, $this->getContainer()->get('cmf_core.publish_workflow.checker')); $this->alternateLocaleProvider = $this->getMock('\\Symfony\\Cmf\\Bundle\\SeoBundle\\AlternateLocaleProviderInterface'); $this->provider->setAlternateLocaleProvider($this->alternateLocaleProvider); $alternateLocale = new AlternateLocale('test', 'de'); $this->alternateLocaleProvider->expects($this->any())->method('createForContent')->will($this->returnValue(new ArrayCollection(array($alternateLocale)))); }
public function testComputingBetweenEvents() { $this->dm->getEventManager()->addEventListener(array(Event::prePersist, Event::postPersist, Event::preUpdate, Event::postUpdate, Event::preMove, Event::postMove), $this->listener); // Create initial user $user = new \Doctrine\Tests\Models\CMS\CmsUser(); $user->name = 'mdekrijger'; $user->username = '******'; $user->status = 'active'; // In prepersist the name will be changed // In postpersist the username will be changed $this->dm->persist($user); $this->dm->flush(); $this->dm->clear(); // Post persist data is not saved to document, so check before reloading document $this->assertTrue($user->username == 'postpersist'); // Be sure that document is really saved by refetching it from ODM $user = $this->dm->find('Doctrine\\Tests\\Models\\CMS\\CmsUser', $user->id); $this->assertEquals('prepersist', $user->name); $this->assertEquals('active', $user->status); // Change document // In preupdate the name will be changed // In postupdate the username will be changed $user->status = 'changed'; $this->dm->persist($user); $this->dm->flush(); $this->dm->clear(); // Post persist data is not saved to document, so check before reloading document $this->assertEquals('postupdate', $user->username); // Be sure that document is really saved by refetching it from ODM $user = $this->dm->find('Doctrine\\Tests\\Models\\CMS\\CmsUser', $user->id); $this->assertEquals('preupdate', $user->name); $this->assertEquals('changed', $user->status); // Move from /functional/preudpate to /functional/moved $targetPath = '/functional/moved'; $this->dm->move($user, $targetPath); $this->dm->flush(); // we overwrote the name and username fields during the move event, so the object changed $this->assertEquals('premove', $user->name); $this->assertEquals('premove-postmove', $user->username); $this->dm->clear(); $user = $this->dm->find('Doctrine\\Tests\\Models\\CMS\\CmsUser', $targetPath); // the document was moved but the only changes applied in preUpdate are persisted, // pre/postMove changes are not persisted in that flush $this->assertEquals('preupdate', $user->name); $this->assertTrue($this->listener->preMove); // Clean up $this->dm->remove($user); $this->dm->flush(); }
/** * TypeTeamUser is not a superclass of User. Still works when loading from cache. */ public function testCacheNotInstanceOf() { $user = $this->dm->find($this->type, '/functional/user'); $this->assertInstanceOf($this->type, $user); $user = $this->dm->find('Doctrine\\Tests\\ODM\\PHPCR\\Functional\\TypeTeamUser', '/functional/user'); $this->assertTrue(null === $user, get_class($user)); }
public function testFetchingMultipleHierarchicalObjectsWithChildIdFirst() { $parent = new ParentTestObj(); $parent->nodename = 'parent'; $parent->name = 'parent'; $parent->parent = $this->dm->find(null, 'functional'); $child = new ParentTestObj(); $child->nodename = 'child'; $child->name = 'child'; $child->parent = $parent; $this->dm->persist($parent); $this->dm->persist($child); $parentId = $this->uow->getDocumentId($parent); $childId = $this->uow->getDocumentId($child); $this->dm->flush(); $this->dm->clear(); // this forces the objects to be loaded in an order where the $parent will become a proxy $documents = $this->dm->findMany('Doctrine\\Tests\\Models\\References\\ParentTestObj', array($childId, $parentId)); $this->assertCount(2, $documents); /* @var $child ParentTestObj */ /* @var $parent ParentTestObj */ $child = $documents->first(); $parent = $documents->last(); $this->assertSame($child->parent, $parent); $this->assertSame('parent', $parent->nodename); }
public function testProxyImplicit() { $user = new CmsUser(); $user->name = 'Dominik'; $user->username = '******'; $user->status = 'developer'; $assistant = new CmsUser(); $assistant->username = '******'; $user->child = $assistant; $this->dm->persist($user); $this->dm->flush(); $this->dm->clear(); $user = $this->dm->find(null, $user->id); $assistant = $this->dm->find(null, $user->id . '/assistant'); $this->assertSame($assistant, $user->child); }
public function testCascadeRemoveByCollection() { $referrerRefManyTestObj = new ReferrerRefTestObj2(); $referrerRefManyTestObj->id = "/functional/referrerRefManyTestObj"; $max = 5; for ($i = 0; $i < $max; $i++) { $newReferrerTestObj = new ReferrerTestObj2(); $newReferrerTestObj->id = "/functional/referrerTestObj{$i}"; $newReferrerTestObj->name = "referrerTestObj{$i}"; $newReferrerTestObj->reference = $referrerRefManyTestObj; $this->dm->persist($newReferrerTestObj); } $this->dm->persist($referrerRefManyTestObj); $this->dm->flush(); $this->dm->clear(); $referenced = $this->dm->find(null, "/functional/referrerRefManyTestObj"); $this->assertCount($max, $referenced->referrers); $referenced->referrers->remove(0); $referenced->referrers->remove(3); $this->assertCount($max - 2, $referenced->referrers); $this->dm->flush(); $this->dm->clear(); $referenced = $this->dm->find(null, "/functional/referrerRefManyTestObj"); $this->assertCount($max - 2, $referenced->referrers); }
public function testFindManyWithNonExistingUuuid() { $user = new TestUser(); $user->username = '******'; $user->id = '/functional/test'; $this->dm->persist($user); $this->dm->flush(); $this->dm->clear(); $actualUuid = $user->uuid; $unusedUuid = UUIDHelper::generateUUID(); $this->assertNotNull($this->dm->find(get_class($user), $user->id)); $this->assertNotNull($this->dm->find(get_class($user), $actualUuid)); $this->assertNull($this->dm->find(get_class($user), $unusedUuid)); $uuids = array($actualUuid, $unusedUuid); $documents = $this->dm->findMany(get_class($user), $uuids); $this->assertEquals(1, count($documents)); }
public function testPropertyname() { $doc = new TestObj(); $doc->id = '/functional/pn'; $doc->name = 'Testname'; $doc->othername = 'Testothername'; $this->dm->persist($doc); $this->dm->flush(); $this->dm->clear(); $this->assertTrue($this->node->getNode('pn')->hasProperty('name')); $this->assertTrue($this->node->getNode('pn')->hasProperty('myname')); $doc = $this->dm->find($this->type, '/functional/pn'); $this->assertNotNull($doc->name); $this->assertEquals('Testname', $doc->name); $this->assertNotNull($doc->othername); $this->assertEquals('Testothername', $doc->othername); }
/** * @expectedException \Doctrine\ODM\PHPCR\PHPCRException */ public function testMoveByUpdateId() { $this->createChildren(); $parent = $this->dm->find($this->type, '/functional/parent'); $child = $parent->allChildren->first(); $child->id = '/functional/elsewhere'; $this->dm->flush(); }
public function testReorderParentProxy() { $first = $this->dm->find(null, '/functional/source/first'); $parent = $first->getParentDocument(); $this->dm->reorder($parent, 'first', 'second', false); $this->dm->flush(); $this->assertSame(array('second', 'first', 'third', 'fourth'), $this->getChildrenNames($parent->getChildren())); }
public function testRefreshProxy() { $parent = new ParentTestObj(); $parent->id = '/functional/parent'; $parent->name = 'parent'; $child = new ParentTestObj(); $child->id = '/functional/parent/child'; $child->name = 'child'; $this->dm->persist($parent); $this->dm->persist($child); $this->dm->flush(); $this->dm->clear(); $child = $this->dm->find(null, '/functional/parent/child'); $this->assertInstanceOf('Doctrine\\Common\\Proxy\\Proxy', $child->parent); $child->parent->name = 'x'; $this->dm->refresh($child->parent); $this->assertEquals('parent', $child->parent->name); }
public function testPersistRepository() { $doc = new RepositoryIdStrategy(); $doc->title = 'repository strategy'; $this->dm->persist($doc); $this->dm->flush(); $id = $this->dm->getUnitOfWork()->getDocumentId($doc); $this->dm->clear(); $this->assertInstanceOf('\\Doctrine\\Tests\\ODM\\PHPCR\\Functional\\Mapping\\RepositoryIdStrategy', $this->dm->find(null, $id)); }
/** * Restore the document to the state it was before * * @param string $documentVersion the version name to restore * @param boolean $removeExisting how to handle identifier collisions * * @see VersionManager::restore */ public function restoreVersion($documentVersion, $removeExisting) { $oid = spl_object_hash($documentVersion); $history = $this->documentHistory[$oid]; $version = $this->documentVersion[$oid]; $document = $this->dm->find(null, $history->getVersionableIdentifier()); $vm = $this->session->getWorkspace()->getVersionManager(); $vm->restore($removeExisting, $version); $this->dm->refresh($document); }
/** * Find one object from the given class repository. * * {@inheritDoc} */ public function find($class, $id) { if (!isset($id)) { return null; } if (null === $class) { return $this->dm->find(null, $id); } return $this->dm->getRepository($class)->find($id); }
public function testChildWithoutId() { $node = $this->resetFunctionalNode($this->dm); $parentId = $node->getPath() . '/parent'; $parent = new ParentDoc(); $parent->id = $parentId; $doc = new DocWithoutId(); $doc->parent = $parent; $doc->nodename = 'foo'; $this->dm->persist($doc); $this->dm->flush(); $this->dm->clear(); $parent = $this->dm->find(null, $parentId); $doc = $parent->children->current(); $this->assertInstanceOf('Doctrine\\Common\\Proxy\\Proxy', $doc); $this->assertInstanceOf('Doctrine\\Tests\\ODM\\PHPCR\\Functional\\DocWithoutId', $doc); $this->assertEquals('foo', $doc->nodename); $this->assertInstanceOf('Doctrine\\Tests\\ODM\\PHPCR\\Functional\\ParentDoc', $doc->parent); }
/** * Create a node with a bad name and allow it to be discovered * among its parent node's children while also explicitly * persisting it. * * @expectedException \Doctrine\ODM\PHPCR\Id\IdException */ public function testIllegalNameManagedChild() { $parent = $this->dm->find($this->type, '/functional/thename'); $child = new NameDoc(); $child->nodename = 'bad/name'; $child->parent = $parent; $parent->children->add($child); $this->dm->persist($child); $this->dm->flush(); }
public function testPage() { $page = new Page(array('add_locale_pattern' => true)); $page->setParentDocument($this->baseDocument); $page->setName('page-name'); $page->setTitle('Page Title'); $page->setLabel('Page Label'); $page->setBody('This is body'); $page->setPublishable(false); $page->setPublishStartDate(new \DateTime('2013-06-18')); $page->setPublishEndDate(new \DateTime('2013-06-18')); $page->setExtras(array('extra_1' => 'foobar', 'extra_2' => 'barfoo')); $this->dm->persist($page); $this->dm->flush(); $this->dm->clear(); $page = $this->dm->find(null, '/test/page-name'); $this->assertNotNull($page); $this->assertTrue($page->getOption('add_locale_pattern')); $this->assertEquals('Page Title', $page->getTitle()); $this->assertEquals('Page Label', $page->getLabel()); $this->assertEquals('This is body', $page->getBody()); $this->assertEquals(array('extra_1' => 'foobar', 'extra_2' => 'barfoo'), $page->getExtras()); // test publish start and end $publishStartDate = $page->getPublishStartDate(); $publishEndDate = $page->getPublishEndDate(); $this->assertInstanceOf('\\DateTime', $publishStartDate); $this->assertInstanceOf('\\DateTime', $publishEndDate); $this->assertEquals('2013-06-18', $publishStartDate->format('Y-m-d')); $this->assertEquals('2013-06-18', $publishEndDate->format('Y-m-d')); // test multi-lang $page->setLocale('fr'); $page->setTitle('french'); $this->dm->persist($page); $this->dm->flush(); $this->dm->clear(); $page = $this->dm->findTranslation(null, '/test/page-name', 'fr'); $this->assertEquals('fr', $page->getLocale()); $this->assertEquals('french', $page->getTitle()); // test node $node = $page->getNode(); $this->assertInstanceOf('PHPCR\\NodeInterface', $node); }
/** * Write a string to a file * * @param string $path file path * @param string $content new file content * @return bool * @author Dmitry (dio) Levashov **/ protected function _filePutContents($path, $content) { /** @var File $doc */ $doc = $this->dm->find(null, $path); if (!$doc instanceof File) { return false; } $doc->setContentFromString($content); $this->dm->persist($doc); $this->dm->flush(); return true; }
public function testChangeset() { $user = $this->node->getNode('user'); // the property is not nullable, but this should only be checked on saving, not on loading $user->getProperty('username')->remove(); $this->dm->getPhpcrSession()->save(); $userDoc = $this->dm->find(null, $user->getPath()); $this->assertInstanceOf($this->type, $userDoc); $this->assertNull($userDoc->username); // nothing should happen, we did not alter any value $this->dm->flush(); }
/** * @param DocumentManager $dm * @param $path * @param $name * * @return bool|Directory */ public static function mkdir(DocumentManager $dm, $path, $name) { $dirname = self::cleanPath($path, $name); if ($dm->find(null, $dirname)) { return false; } $dir = new Directory(); $dir->setName($name); $dir->setId($dirname); $dm->persist($dir); $dm->flush(); return $dir; }
public function testComputingBetweenEvents() { $this->dm->getEventManager()->addEventListener(array(Event::postLoad, Event::prePersist, Event::preUpdate, Event::postPersist, Event::postUpdate), $this->listener); $entity = new SomeEntity(); $entity->id = '/functional/test'; $entity->status = new \stdClass(); $entity->status->value = 'active'; $entity->status->foo = 'bar'; $entity->text = 'test1'; $this->dm->persist($entity); $this->dm->flush(); $this->assertInstanceOf('stdClass', $entity->status); $this->assertAttributeNotEmpty('value', $entity->status); $this->assertEquals($entity->status->value, 'active'); $this->assertObjectNotHasAttribute('foo', $entity->status); $entity->status->value = 'inactive'; $entity->status->foo = 'bar2'; $entity->text = 'test2'; $this->dm->flush(); $this->assertInstanceOf('stdClass', $entity->status); $this->assertAttributeNotEmpty('value', $entity->status); $this->assertEquals($entity->status->value, 'inactive'); $this->assertObjectNotHasAttribute('foo', $entity->status); $this->assertEquals($entity->text, 'test2'); $this->dm->clear(); $entity = $this->dm->find(null, $entity->id); $this->assertInstanceOf('stdClass', $entity->status); $this->assertAttributeNotEmpty('value', $entity->status); $this->assertEquals($entity->status->value, 'inactive'); $this->assertObjectNotHasAttribute('foo', $entity->status); $this->assertEquals($entity->text, 'test2'); $entity->status->value = 'active'; $this->dm->flush(); $this->assertInstanceOf('stdClass', $entity->status); $this->assertAttributeNotEmpty('value', $entity->status); $this->assertEquals($entity->status->value, 'active'); $this->assertEquals($entity->text, 'test2'); }