Beispiel #1
0
 public function testIncrementSetsNull()
 {
     $user = new User();
     $user->setUsername('jon');
     $user->setCount(10);
     $user->setFloatCount(10);
     $this->dm->persist($user);
     $this->dm->flush();
     $this->dm->clear();
     $user = $this->dm->getRepository('Documents\\User')->findOneBy(array('username' => 'jon'));
     $this->assertSame(10, $user->getCount());
     $this->assertSame(10.0, $user->getFloatCount());
     $user->incrementCount(1);
     $user->incrementFloatCount(1);
     $this->dm->flush();
     $this->dm->clear();
     $user = $this->dm->getRepository('Documents\\User')->findOneBy(array('username' => 'jon'));
     $this->assertSame(11, $user->getCount());
     $this->assertSame(11.0, $user->getFloatCount());
     $user->setCount(null);
     $user->setFloatCount(null);
     $this->dm->flush();
     $this->dm->clear();
     $user = $this->dm->getRepository('Documents\\User')->findOneBy(array('username' => 'jon'));
     $this->assertSame(null, $user->getCount());
     $this->assertSame(null, $user->getFloatCount());
 }