public function testGetCreateSQLWithFloatDataFromAnnotatedEntity()
 {
     $this->annotatedTest->setString("some string");
     $this->annotatedTest->setFloat(0.019284);
     $sql = $this->annotatedTableData->getCreateSQL($this->annotatedTest);
     $this->assertEqualsFixture($sql, __FUNCTION__, $this->annotatedTest->getId());
     $this->runQuery($sql);
 }
Example #2
0
 public function testCreateEntityWithData()
 {
     $this->entity->setOneToOneChild(new ChildTest());
     $this->entity->setBoolean(true);
     $this->entity->setFloat(0.1);
     $this->entity->setInt(1);
     $this->entity->setTransient("this is never stored to db");
     $this->entity->setOneToManyChild(array(new ChildTest(), new ChildTest()));
     $this->annotatedTestDao->create($this->entity);
     /**
      * @var $dbEntity AnnotatedTest
      */
     $dbEntity = $this->annotatedTestDao->find($this->entity->getId());
     $this->assertEquals($this->entity->getId(), $dbEntity->getId());
     $this->assertEquals($this->entity->isBoolean(), $dbEntity->isBoolean());
     $this->assertEquals($this->entity->getFloat(), $dbEntity->getFloat());
     $this->assertEquals($this->entity->getString(), $dbEntity->getString());
     $this->assertNotEquals($this->entity->getTransient(), $dbEntity->getTransient());
     $this->assertEquals($this->entity->getInt(), $dbEntity->getInt());
     $this->annotatedTestDao->initializeDeep($dbEntity);
     $this->assertEquals($this->entity->getOneToOneChild(), $dbEntity->getOneToOneChild());
     $this->assertEquals($this->entity->getOneToManyChild(), $dbEntity->getOneToManyChild());
 }