コード例 #1
0
 /**
  * 
  */
 public function testPrepareInsert()
 {
     $oEntity = new ApplicationUser();
     $oConfig = Configuration::getInstance();
     $oConfig->read(__DIR__ . self::MYSQL_TEST_CONFIG);
     $oDbal = new DbalManager(new DriverFactory(), $oConfig);
     $oMapper = new AnnotationMapping();
     $oMapper->mapEntity(\get_class($oEntity));
     $oPrepare = new PrepareStatementImpl();
     $insert = $oPrepare->insert($oEntity, $oMapper, $oDbal->getDataObject());
 }
コード例 #2
0
 /**
  * 
  */
 public function testMapEntityAttributesToColumns()
 {
     $oEntity = new ApplicationUser();
     $oEntity->setId(1);
     $oEntity->setEmail('*****@*****.**');
     $oEntity->setDisplayName('FOO BAR');
     $oEntity->setUsername('foobar');
     $oEntity->setCreatedOn(new \DateTime('now'));
     $sClassname = \get_class($oEntity);
     $oMapper = new AnnotationMapping();
     $oMapper->mapEntity(\get_class($oEntity));
     $aMappings = $oMapper->getAllMappings();
     //View the returned array first before assertions.
     print_r($aMappings);
     $this->assertInternalType('array', $aMappings);
     $this->assertArrayHasKey($sClassname, $aMappings);
     $aEntityMap = $aMappings[$sClassname];
     //View the returned array first before assertions.
     print_r($aEntityMap);
     $this->assertNotEmpty($aEntityMap);
     $this->assertArrayHasKey(AnnotationMapping::KEY_TABLE, $aEntityMap);
     $this->assertArrayHasKey(AnnotationMapping::KEY_COLUMNS, $aEntityMap);
 }