Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 56 lines (43 sloc) 1.319 kb
bb3db5c Adding integration tests along with MongoDB constraint types for PHPUnit
XirisR authored
1 <?php
2 /**
3 * @author Jonathan Moss <xirisr@gmail.com>
4 * @copyright 2010 Jonathan Moss
30132df git-svn-id: http://mongodb-morph.googlecode.com/svn/trunk@120 406649b4-5...
XirisR authored
5 * @package Morph
bb3db5c Adding integration tests along with MongoDB constraint types for PHPUnit
XirisR authored
6 */
2207877 refactoring of integration test
XirisR authored
7
8 require_once dirname(__FILE__).'/../Morph.phar';
aecbbe8 refactoring integration tests by creating a 'MongoUnit' subproject
XirisR authored
9 require_once dirname(__FILE__).'/MongoUnit/TestCase.php';
b5e4010 updated to run from Phing build script
XirisR authored
10 require_once dirname(__FILE__).'/test-objects/HasManyParent.php';
11 require_once dirname(__FILE__).'/test-objects/Child.php';
bb3db5c Adding integration tests along with MongoDB constraint types for PHPUnit
XirisR authored
12
30132df git-svn-id: http://mongodb-morph.googlecode.com/svn/trunk@120 406649b4-5...
XirisR authored
13 /**
14 * @package Morph
15 */
aecbbe8 refactoring integration tests by creating a 'MongoUnit' subproject
XirisR authored
16 class TestHasMany extends MongoUnit_TestCase
bb3db5c Adding integration tests along with MongoDB constraint types for PHPUnit
XirisR authored
17 {
18
aecbbe8 refactoring integration tests by creating a 'MongoUnit' subproject
XirisR authored
19 public function setup()
bb3db5c Adding integration tests along with MongoDB constraint types for PHPUnit
XirisR authored
20 {
aecbbe8 refactoring integration tests by creating a 'MongoUnit' subproject
XirisR authored
21 parent::setup();
22 Morph_Storage::init($this->getDatabase());
1d1a766 updating integration tests for new Morph_Storage usage pattern
XirisR authored
23 }
24
25 public function tearDown()
26 {
27 parent::tearDown();
28 Morph_Storage::deInit();
bb3db5c Adding integration tests along with MongoDB constraint types for PHPUnit
XirisR authored
29 }
30
31 public function testStoresParentAndChildren()
32 {
33 $parent = new HasManyParent();
34 $parent->Name = 'Has Many Parent';
35
36 $child1 = new Child();
37 $child1->Name = 'Child1';
38
39 $parent->Children[] = $child1;
40
41 $child2 = new Child();
42 $child2->Name = 'Child2';
43
44 $parent->Children[] = $child2;
45
1d1a766 updating integration tests for new Morph_Storage usage pattern
XirisR authored
46 $parent->save();
bb3db5c Adding integration tests along with MongoDB constraint types for PHPUnit
XirisR authored
47 $this->assertCollectionExists('HasManyParent');
48 $this->assertCollectionExists('Child');
49
50 $this->assertDocumentExists('HasManyParent', $parent->id());
51 $this->assertDocumentExists('Child', $child1->id());
52 $this->assertDocumentExists('Child', $child2->id());
53
54 }
55
56 }
Something went wrong with that request. Please try again.