Browse files

Merge pull request #60 from schmittjoh/patch-1

allow results to be set manually
  • Loading branch information...
2 parents 486a9b8 + 0c7bed6 commit 12f71d99457b018fb80746f84514dd5b495c5789 @pablodip pablodip committed Aug 22, 2012
Showing with 16 additions and 0 deletions.
  1. +5 −0 src/Pagerfanta/Pagerfanta.php
  2. +11 −0 tests/Pagerfanta/Tests/PagerfantaTest.php
View
5 src/Pagerfanta/Pagerfanta.php
@@ -169,6 +169,11 @@ public function getNbResults()
return $this->nbResults;
}
+
+ public function setNbResults($count)
+ {
+ $this->nbResults = (integer) $count;
+ }
/**
* {@inheritdoc}
View
11 tests/Pagerfanta/Tests/PagerfantaTest.php
@@ -242,6 +242,17 @@ public function testHaveToPaginate()
$this->pagerfanta->setMaxPerPage(9);
$this->assertTrue($this->pagerfanta->haveToPaginate());
}
+
+ public function testSetNbResults()
+ {
+ $this->adapter
+ ->expects($this->never())
+ ->method('getNbResults')
+ ;
+
+ $this->pagerfanta->setNbResults(2);
+ $this->assertEquals(2, $this->pagerfanta->getNbResults());
+ }
public function testHasGetPreviousNextPage()
{

0 comments on commit 12f71d9

Please sign in to comment.