Пример #1
0
 public function testCreateShouldReturnItemWithCorrectInsertId()
 {
     $this->db->expects($this->once())->method('lastInsertId')->with($this->equalTo('*PREFIX*table'))->will($this->returnValue(3));
     $this->mapper = new ExampleMapper($this->db);
     $sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' . 'VALUES(?,?)';
     $params = array('john', 'my@email');
     $entity = new Example();
     $entity->setPreName($params[0]);
     $entity->setEmail($params[1]);
     $this->setMapperResult($sql, $params);
     $result = $this->mapper->insert($entity);
     $this->assertEquals(3, $result->getId());
 }