public function testFetchSingleByIdResult()
 {
     $data = array(array('id' => 42, 'firstname' => 'Manfred', 'lastname' => 'Mustermann', 'street' => 'Am Testen 123', 'postcode' => '54321', 'city' => 'Musterhausen', 'country' => 'de'));
     $mockDbStatement = $this->getMock('Zend\\Db\\Adapter\\Driver\\StatementInterface');
     $mockDbStatement->expects($this->any())->method('execute')->will($this->returnValue($data));
     $mockDbDriver = $this->getMock('Zend\\Db\\Adapter\\Driver\\DriverInterface');
     $mockDbDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockDbStatement));
     $mockDbAdapter = $this->getMock('Zend\\Db\\Adapter\\Adapter', null, array($mockDbDriver));
     $customerTable = new CustomerTable($mockDbAdapter);
     $customerEntity = $customerTable->fetchSingleById(42);
     $this->assertInstanceOf('Customer\\Entity\\CustomerEntity', $customerEntity);
     $this->assertSame($data[0]['id'], $customerEntity->getId());
     $this->assertSame($data[0]['firstname'], $customerEntity->getFirstname());
     $this->assertSame($data[0]['lastname'], $customerEntity->getLastname());
     $this->assertSame($data[0]['street'], $customerEntity->getStreet());
     $this->assertSame($data[0]['postcode'], $customerEntity->getPostcode());
     $this->assertSame($data[0]['city'], $customerEntity->getCity());
     $this->assertSame($data[0]['country'], $customerEntity->getCountry());
 }
 public function testDeleteExistingCustomer()
 {
     $customerTable = new CustomerTable($this->adapter);
     $customerEntity = $customerTable->fetchSingleById(42);
     $customerTable->deleteCustomer($customerEntity);
     $queryTable = $this->getConnection()->createQueryTable('loadCustomersOrderedByLastname', 'SELECT * FROM customers WHERE id = "42";');
     $this->assertEquals(0, $queryTable->getRowCount());
 }