Skip to content

Commit

Permalink
Finish unit tests closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Hughes committed Feb 27, 2015
1 parent c5e3c10 commit 79f4eaa
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 48 deletions.
29 changes: 29 additions & 0 deletions tests/HumanApi/Endpoint/LocationsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Choccybiccy\HumanApi\Endpoint;

/**
* Class LocationsTest
* @package Choccybiccy\HumanApi\Endpoint
*/
class LocationsTest extends \PHPUnit_Framework_TestCase
{

/**
* Test build specific entry url
*/
public function testBuildSpecificEntryUrl()
{

$locations = $this->getMock('Choccybiccy\HumanApi\Endpoint\Locations');
$type = $this->getProtectedProperty($locations, "type");
$id = 1;

$locations->expects($this->once())
->method("buildUrlParts")
->with($type, $id);

$this->runProtectedMethod($locations, "buildSpecificEntryUrl", array($id));

}
}
File renamed without changes.
21 changes: 4 additions & 17 deletions tests/unit/EndpointTest.php → tests/HumanApi/EndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Choccybiccy\HumanApi;

require_once __DIR__ . "/Traits/ReflectionMethods.php";
use Choccybiccy\HumanApi\Traits\ReflectionMethods;

/**
* Class EndpointTest
Expand All @@ -11,7 +11,7 @@
class EndpointTest extends \PHPUnit_Framework_TestCase
{

use Traits\ReflectionMethods;
use ReflectionMethods;

/**
* Get mock endpoint
Expand Down Expand Up @@ -109,9 +109,9 @@ public function testGetRecent()
$params = array("test" => "param");
$url = "test";

$endpoint = $this->getMockEndpoint(array("buildRecent", "fetchResults"));
$endpoint = $this->getMockEndpoint(array("buildRecentUrl", "fetchResults"));
$endpoint->expects($this->once())
->method("buildRecent")
->method("buildRecentUrl")
->willReturn($url);
$endpoint->expects($this->once())
->method("fetchResults")
Expand Down Expand Up @@ -142,17 +142,4 @@ public function testBuildCollection()
$this->assertInstanceOf('\Choccybiccy\HumanApi\Model', $collection->current());

}

/**
* Test fetch results
*/
public function testFetchResults()
{

$params = array("test" => "param");
$url = "test";

$collection = $this->runProtectedMethod($endpoint, "fetchResults", array($url, $params));

}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 0 additions & 12 deletions tests/unit/CollectionTest.php

This file was deleted.

19 changes: 0 additions & 19 deletions tests/unit/Endpoint/LocationsTest.php

This file was deleted.

0 comments on commit 79f4eaa

Please sign in to comment.