From 0cd31abbc4e520d93bc4a0f5480dc898bbe5f25b Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Tue, 9 Dec 2014 19:54:43 -0500 Subject: Change API::getProjectByName() to reflect the documentation --- app/Model/Project.php | 6 +++--- tests/functionals/ApiTest.php | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/Model/Project.php b/app/Model/Project.php index c657e823..c4ec232a 100644 --- a/app/Model/Project.php +++ b/app/Model/Project.php @@ -52,12 +52,12 @@ class Project extends Base * Get a project by the name * * @access public - * @param string $project_name Project name + * @param string $name Project name * @return array */ - public function getByName($project_name) + public function getByName($name) { - return $this->db->table(self::TABLE)->eq('name', $project_name)->findOne(); + return $this->db->table(self::TABLE)->eq('name', $name)->findOne(); } /** diff --git a/tests/functionals/ApiTest.php b/tests/functionals/ApiTest.php index da6b62f5..a9196121 100644 --- a/tests/functionals/ApiTest.php +++ b/tests/functionals/ApiTest.php @@ -80,6 +80,21 @@ class Api extends PHPUnit_Framework_TestCase $this->assertEquals(1, $project['id']); } + public function testGetProjectByName() + { + $project = $this->client->getProjectByName('API test'); + $this->assertNotEmpty($project); + $this->assertEquals(1, $project['id']); + + $project = $this->client->getProjectByName(array('name' => 'API test')); + $this->assertNotEmpty($project); + $this->assertEquals(1, $project['id']); + + $project = $this->client->getProjectByName('None'); + $this->assertEmpty($project); + $this->assertNull($project); + } + public function testUpdateProject() { $project = $this->client->getProjectById(1); -- cgit v1.2.3