Example #1
0
 public function testPersistAssociationsManyToMany2()
 {
     $tag = $this->object->find('App\\Models\\Tag', 4);
     $applications = $tag->applications;
     $this->assertEquals(2, count($tag->applications));
     $this->assertEquals(array(2, 5), array_keys($tag->applications));
     $tag->applications = NULL;
     $this->object->persist($tag);
     $this->object->flush();
     $this->assertFalse(dibi::select("[application_id]")->from("applications_tags")->where("[tag_id] = %i", 4)->execute()->fetchSingle());
     $this->assertNull($tag->applications);
     $tag->applications = $applications;
     $this->object->persist($tag);
     $this->object->flush();
     $this->assertEquals(2, dibi::select("[application_id]")->from("applications_tags")->where("[tag_id] = %i", 4)->execute()->fetchSingle());
     $this->assertEquals(2, count($tag->applications));
     $this->assertEquals(array(2, 5), array_keys($tag->applications));
 }
Example #2
0
 public function testGetInstance2()
 {
     $data = new FooEntity();
     $propRef = new PropertyReflection('ActiveMapperTests\\MetaData\\FooEntity', 'text');
     $propRef->setAccessible(TRUE);
     $propRef->setValue($data, "Test text");
     $propRef->setAccessible(FALSE);
     $this->assertEquals($data, Metadata::getMetadata('ActiveMapperTests\\MetaData\\FooEntity')->getInstance(\ActiveMapper\Manager::getManager(), array('text' => "Test text")));
 }
Example #3
0
 protected function setUp()
 {
     $this->manager = Manager::getManager();
     $this->object = new DibiPersister($this->manager, 'App\\Models\\Author');
 }
Example #4
0
 public function setUp()
 {
     $this->object = new Map(\ActiveMapper\Manager::getManager());
 }
Example #5
0
 protected function setUp()
 {
     $this->manager = \ActiveMapper\Manager::getManager();
 }
Example #6
0
 protected function setUp()
 {
     $this->manager = Manager::getManager();
     $this->object = new UnitOfWork($this->manager);
 }
Example #7
0
 public function setUp()
 {
     $this->object = new IdentityMap(\ActiveMapper\Manager::getManager(), 'App\\Models\\Author');
 }
Example #8
0
 public function testGetInstance()
 {
     $data = new Manager(dibi::getConnection());
     $this->assertEquals($data, Manager::getManager());
     $this->assertEquals($data, Manager::getManager(dibi::getConnection()));
 }
Example #9
0
 public function setUp()
 {
     $this->object = new FooEntity(array('id' => 1, 'text' => "Test text"));
     $this->manager = \ActiveMapper\Manager::getManager();
 }