public function testPhonebookCRUDTest()
 {
     $phonebook = new Phonebook($this->container->getDbConnection());
     $this->assertEquals('id', $phonebook->getPK());
     // Create new contact
     $phonebook->setFirstName('Test');
     $phonebook->setLastName('Contact');
     $phonebook->setBirthDate('1911-11-11');
     $phonebook->setPhoneNumber('+1234567890');
     $id = $phonebook->insert();
     $this->assertEquals(6, $id);
     // Read the new contact from the db
     $contact = $phonebook->getByField('id', 6)[0];
     $this->assertEquals('Test', $contact['first_name']);
     $this->assertEquals('Contact', $contact['last_name']);
     $this->assertEquals('1911-11-11', $contact['birthdate']);
     $this->assertEquals('+1234567890', $contact['phone_number']);
     // Update the new contact and check the db is updated correctly
     $phonebook->setId(6);
     $phonebook->setLastName('Edited');
     $phonebook->setBirthdate('1922-02-02');
     $phonebook->update();
     $contact = $phonebook->getByField('id', 6)[0];
     $this->assertEquals('Test', $contact['first_name']);
     $this->assertEquals('Edited', $contact['last_name']);
     $this->assertEquals('1922-02-02', $contact['birthdate']);
     $this->assertEquals('+1234567890', $contact['phone_number']);
     // Delete the new contact and associated data from the db; check that it can't be read anymore
     $contact = $phonebook->deleteById(6);
     $contact = $phonebook->getByField('id', 6);
     $this->assertEmpty($contact);
     // test getAll() to count centers
     $allContacts = $phonebook->getAll();
     $this->assertCount(3, $allContacts);
 }
 private function readContactDataFromPost(Phonebook $contact)
 {
     $contact->setFirstName($_POST['first_name']);
     $contact->setLastName($_POST['last_name']);
     $contact->setBirthdate($_POST['birthdate']);
     $contact->setPhoneNumber($_POST['phone_number']);
 }