public function test_getters_and_setters() { $entity = new ExampleEntity(); $entity->setId(2); $entity->setName("test name"); $entity->setNullable("not null"); $entity->setNumeral(3); $entity->setCreated("2012-12-12 12:12:12"); $entity->setUpdated("2012-12-13 13:13:13"); $this->assertEqual($entity->getId(), 2); $this->assertEqual($entity->getName(), "test name"); $this->assertEqual($entity->getNullable(), "not null"); $this->assertEqual($entity->getNumeral(), 3); $this->assertEqual($entity->getCreated(), "2012-12-12 12:12:12"); $this->assertEqual($entity->getUpdated(), "2012-12-13 13:13:13"); }
/** * @param array $arr * * @return ExampleEntity */ protected function mapArrayToEntity($arr) { $object = new ExampleEntity(); $object->setId($arr['id']); $object->setName($arr['name']); $object->setNullable($arr['nullable']); $object->setNumeral($arr['numeral']); $object->setCreated($arr['created']); $object->setUpdated($arr['updated']); return $object; }
public function test_baseCountBy() { $entityIn1 = new ExampleEntity(); $entityIn1->setName('baseCountBy'); $entityIn1->setNullable('not null'); $entityIn1->setNumeral(5); $entityIn2 = new ExampleEntity(); $entityIn2->setName('baseCountBy'); $entityIn2->setNullable('not null'); $entityIn2->setNumeral(6); $entityGateway = ExampleEntityGatewayFactory::create(); $entityGateway->create($entityIn1); $entityGateway->create($entityIn2); $count = $entityGateway->countByName('baseCountBy'); $this->assertEqual(2, $count); }