/** * @dataProvider validProviderFromArray */ public function testValidFromArray($id, $secret, $type, $redirectUri, $name, $allowedScope, $icon, $description, $contactEmail) { $c = new ClientData(array('id' => $id, 'secret' => $secret, 'redirect_uri' => $redirectUri, 'name' => $name, 'type' => $type, 'allowed_scope' => $allowedScope, 'icon' => $icon, 'description' => $description, 'contact_email' => $contactEmail)); $this->assertEquals($id, $c->getId()); $this->assertEquals($secret, $c->getSecret()); $this->assertEquals($redirectUri, $c->getRedirectUri()); $this->assertEquals($name, $c->getName()); $this->assertEquals($allowedScope, $c->getAllowedScope()); $this->assertEquals($icon, $c->getIcon()); $this->assertEquals($description, $c->getDescription()); $this->assertFalse($c->getDisableUserConsent()); $this->assertEquals($contactEmail, $c->getContactEmail()); }
public function addClient(ClientData $clientData) { $stmt = $this->db->prepare('INSERT INTO clients (id, name, description, secret, disable_user_consent, redirect_uri, type, icon, allowed_scope, contact_email) VALUES(:client_id, :name, :description, :secret, :disable_user_consent, :redirect_uri, :type, :icon, :allowed_scope, :contact_email)'); $stmt->bindValue(':client_id', $clientData->getId(), PDO::PARAM_STR); $stmt->bindValue(':name', $clientData->getName(), PDO::PARAM_STR); $stmt->bindValue(':description', $clientData->getDescription(), PDO::PARAM_STR); $stmt->bindValue(':secret', $clientData->getSecret(), PDO::PARAM_STR); $stmt->bindValue(':redirect_uri', $clientData->getRedirectUri(), PDO::PARAM_STR); $stmt->bindValue(':disable_user_consent', $clientData->getDisableUserConsent(), PDO::PARAM_BOOL); $stmt->bindValue(':type', $clientData->getType(), PDO::PARAM_STR); $stmt->bindValue(':icon', $clientData->getIcon(), PDO::PARAM_STR); $stmt->bindValue(':allowed_scope', $clientData->getAllowedScope(), PDO::PARAM_STR); $stmt->bindValue(':contact_email', $clientData->getContactEmail(), PDO::PARAM_STR); $stmt->execute(); return 1 === $stmt->rowCount(); }