-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06f835e
commit 604dad5
Showing
5 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php namespace Monger\SearchRequest\Tests\Term; | ||
|
||
use Monger\SearchRequest\SearchRequest; | ||
|
||
class InvalidationTest extends \PHPUnit_Framework_TestCase { | ||
|
||
/** | ||
* @var \Monger\SearchRequest\SearchRequest | ||
*/ | ||
protected $request; | ||
|
||
/** | ||
* Set up before each test | ||
*/ | ||
public function setup() | ||
{ | ||
$this->request = new SearchRequest; | ||
} | ||
|
||
/** | ||
* @test | ||
* @expectedException InvalidArgumentException | ||
*/ | ||
public function pageArray() | ||
{ | ||
$this->request->term(['not an integer']); | ||
} | ||
|
||
/** | ||
* @test | ||
* @expectedException InvalidArgumentException | ||
*/ | ||
public function pageFloat() | ||
{ | ||
$this->request->term(56.54); | ||
} | ||
|
||
/** | ||
* @test | ||
* @expectedException InvalidArgumentException | ||
*/ | ||
public function pageNegative() | ||
{ | ||
$this->request->term(-5); | ||
} | ||
|
||
/** | ||
* @test | ||
* @expectedException InvalidArgumentException | ||
*/ | ||
public function pageInt() | ||
{ | ||
$this->request->term(6); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php namespace Monger\SearchRequest\Tests\Term; | ||
|
||
use Monger\SearchRequest\SearchRequest; | ||
|
||
class TermTest extends \PHPUnit_Framework_TestCase { | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function defaults() | ||
{ | ||
$request = new SearchRequest; | ||
|
||
$this->assertEquals(null, $request->getTerm()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function string() | ||
{ | ||
$request = new SearchRequest; | ||
|
||
$request->term('something'); | ||
|
||
$this->assertEquals('something', $request->getTerm()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function clear() | ||
{ | ||
$request = new SearchRequest; | ||
|
||
$request->term('something'); | ||
$request->term(null); | ||
|
||
$this->assertEquals(null, $request->getTerm()); | ||
} | ||
|
||
} |