From f3aa60fdfc16fc89c0f9f69a6a6d2a479624bb51 Mon Sep 17 00:00:00 2001 From: Nuno Rafael Rocha Date: Fri, 24 Apr 2015 22:43:14 +0100 Subject: [PATCH] Add getter for currencies to user model Closes #76. --- lib/Bitreserve/Model/User.php | 15 +++++++++++++++ lib/Bitreserve/Model/UserInterface.php | 7 +++++++ test/Bitreserve/Tests/Unit/Model/UserTest.php | 14 ++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/lib/Bitreserve/Model/User.php b/lib/Bitreserve/Model/User.php index f69f138..d6c1712 100644 --- a/lib/Bitreserve/Model/User.php +++ b/lib/Bitreserve/Model/User.php @@ -17,6 +17,13 @@ class User extends BaseModel implements UserInterface */ protected $country; + /** + * Currencies. + * + * @var string + */ + protected $currencies; + /** * Email. * @@ -178,6 +185,14 @@ public function getCountry() return $this->country; } + /** + * {@inheritdoc} + */ + public function getCurrencies() + { + return $this->currencies; + } + /** * {@inheritdoc} */ diff --git a/lib/Bitreserve/Model/UserInterface.php b/lib/Bitreserve/Model/UserInterface.php index 694a4db..386d0ad 100644 --- a/lib/Bitreserve/Model/UserInterface.php +++ b/lib/Bitreserve/Model/UserInterface.php @@ -53,6 +53,13 @@ public function getContacts(); */ public function getCountry(); + /** + * Gets user currencies. + * + * @return $currencies + */ + public function getCurrencies(); + /** * Gets user email. * diff --git a/test/Bitreserve/Tests/Unit/Model/UserTest.php b/test/Bitreserve/Tests/Unit/Model/UserTest.php index 671a384..eb55fb7 100644 --- a/test/Bitreserve/Tests/Unit/Model/UserTest.php +++ b/test/Bitreserve/Tests/Unit/Model/UserTest.php @@ -131,6 +131,20 @@ public function shouldReturnCountry() $this->assertEquals($data['country'], $user->getCountry()); } + /** + * @test + */ + public function shouldReturnCurrencies() + { + $data = array('currencies' => array('BTC', 'EUR', 'USD')); + + $client = $this->getBitreserveClientMock(); + + $user = new User($client, $data); + + $this->assertEquals($data['currencies'], $user->getCurrencies()); + } + /** * @test */