Skip to content
This repository was archived by the owner on Nov 2, 2022. It is now read-only.

Commit b7e9d2f

Browse files
committed
fixes tests for client public key
1 parent a12d21e commit b7e9d2f

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

Entity/ClientPublicKey.php

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public function setClient(\OAuth2\ServerBundle\Entity\Client $client = null)
3232
{
3333
$this->client = $client;
3434

35+
// this is necessary as the client_id is the primary key
36+
$this->client_id = $client->getClientId();
37+
3538
return $this;
3639
}
3740

@@ -45,29 +48,6 @@ public function getClient()
4548
return $this->client;
4649
}
4750

48-
/**
49-
* Set client
50-
*
51-
* @param $client_id
52-
* @return ClientPublicKey
53-
*/
54-
public function setClientId($client_id)
55-
{
56-
$this->client_id = $client_id;
57-
58-
return $this;
59-
}
60-
61-
/**
62-
* Get client_id
63-
*
64-
* @return integer $client_id
65-
*/
66-
public function getClientId()
67-
{
68-
return $this->client_id;
69-
}
70-
7151
/**
7252
* Set public key
7353
*

Tests/Entity/ClientPublicKeyTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ public function testCreate()
2222
$em->flush();
2323

2424
$public_key = new ClientPublicKey();
25-
$public_key->setClientId($client->getClientId());
25+
$public_key->setClient($client);
2626

2727
// create and set the public key
2828
$res = openssl_pkey_new();
2929

3030
// Extract the public key from $res to $pubKey
31-
$pubKey = openssl_pkey_get_details($res)['key'];
31+
$pubKeyDetails = openssl_pkey_get_details($res);
32+
$pubKey = $pubKeyDetails['key'];
3233
$public_key->setPublicKey($pubKey);
3334

3435
$em->persist($public_key);

0 commit comments

Comments
 (0)