Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bakura10 committed Feb 16, 2014
1 parent 9041d27 commit b21c3ed
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions tests/ZfrRestTest/Router/Http/Matcher/BaseSubPathMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,19 @@ public function testMatchOnSelectableIfNoPreviousMatch($subPath)
$data->expects($this->once())
->method('matching')
->with($this->isInstanceOf('Doctrine\Common\Collections\Criteria'))
->will($this->returnValue('Doctrine\Common\Collections\Collection'));
->will($this->returnValue($this->getMock('Doctrine\Common\Collections\Collection')));

$metadata = $this->getMock('ZfrRest\Resource\Metadata\ResourceMetadataInterface');

//$reflClass = $this->getMock('ReflectionClass', [], [], '', false);
//$reflClass->expects($this->once())->method('isInstance')->will($this->returnValue(true));

$resource = $this->getMock('ZfrRest\Resource\ResourceInterface');
$resource->expects($this->once())->method('getData')->will($this->returnValue($data));
$resource->expects($this->once())->method('getMetadata')->will($this->returnValue($metadata));

// With no previous match, it should create a new one
$this->assertInstanceOf(
'ZfrRest\Router\Http\Matcher\SubPathMatch',
$this->baseMatcher->matchSubPath($resource, $subPath)
);
$match = $this->baseMatcher->matchSubPath($resource, $subPath);
$resource = $match->getMatchedResource();

// With an existing match, it should reuse it
$match = $this->getMock('ZfrRest\Router\Http\Matcher\SubPathMatch', [], [], '', false);
$this->assertSame($match, $this->baseMatcher->matchSubPath($resource, $subPath, $match));
$this->assertInstanceOf('ZfrRest\Router\Http\Matcher\SubPathMatch', $match);
$this->assertSame($metadata, $resource->getMetadata());
}

public function testReturnsNullIfNoMatchFromMatchers()
Expand Down

0 comments on commit b21c3ed

Please sign in to comment.