This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://mongodb-morph.googlecode.com/svn/trunk@116 406649b4-5d4b-11de-8abc-d1c337b90d21
- Loading branch information
XirisR
authored and
XirisR
committed
Feb 1, 2010
1 parent
b85fbf7
commit 1bcc90f
Showing
2 changed files
with
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* @author Jonathan Moss <xirisr@gmail.com> | ||
* @copyright 2010 Jonathan Moss | ||
*/ | ||
|
||
require_once dirname(__FILE__).'/../Morph.phar'; | ||
require_once dirname(__FILE__).'/MongoUnit/TestCase.php'; | ||
require_once dirname(__FILE__).'/test-objects/Child.php'; | ||
|
||
class TestSingleObject extends MongoUnit_TestCase | ||
{ | ||
|
||
public function setup() | ||
{ | ||
parent::setup(); | ||
Morph_Storage::init($this->getDatabase()); | ||
//load data from file to query against | ||
$this->loadJsonFileDatasetIntoCollection('Child', dirname(__FILE__). '/fixtures/children.json'); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
parent::tearDown(); | ||
Morph_Storage::deInit(); | ||
} | ||
|
||
public function testCanFindByValue() | ||
{ | ||
$child = new Child(); | ||
$query = new Morph_Query(); | ||
$query->property('Name')->equals('a_musing_moose'); | ||
$results = $child->findByQuery($query); | ||
$this->assertEquals(1, $results->totalCount()); | ||
} | ||
|
||
public function testCanFindByLike() | ||
{ | ||
$child = new Child(); | ||
$query = new Morph_Query(); | ||
$query->property('Name')->like('moose'); | ||
$results = $child->findByQuery($query); | ||
$this->assertEquals(4, $results->totalCount()); | ||
} | ||
} |
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 @@ | ||
[{"Name":"a_musing_moose"},{"Name":"a_moose_musing"},{"Name":"moose_musing_a"},{"Name":"musing_moose_a"}] |