Inheritance: extends My_ShantyMongo_Abstract
Esempio n. 1
0
 public function setUp()
 {
     parent::setUp();
     $this->_bob = My_ShantyMongo_User::find('4c04516a1f5f5e21361e3ab0');
     $this->_cherry = My_ShantyMongo_User::find('4c04516f1f5f5e21361e3ab1');
     $this->_roger = My_ShantyMongo_User::find('4c0451791f5f5e21361e3ab2');
     $this->_articleRegular = My_ShantyMongo_Article::find('4c04516f1f5f5e21361e3ac1');
     $this->_articleBroken = My_ShantyMongo_Article::find('4c04516f1f5f5e21361e3ac2');
 }
Esempio n. 2
0
 public function setUp()
 {
     parent::setUp();
     $this->_bob = My_ShantyMongo_User::find('4c04516a1f5f5e21361e3ab0');
     $this->_article = My_ShantyMongo_Article::find('4c04516f1f5f5e21361e3ac1');
 }
Esempio n. 3
0
 /**
  * Test for issue https://github.com/coen-hyde/Shanty-Mongo/issues/50
  *
  * @return void
  * @author Tom Holder
  **/
 public function testConcreteClassFromArray()
 {
     $data = array('title' => '101 reasons mongo is the bomb digidy', 'relatedArticles' => array(array('title' => '102 reasons mongo is the bomb digidy', 'relatedArticles' => array(array('title' => '103 reasons mongo is the bomb digidy')))));
     $article = new My_ShantyMongo_Article($data);
     $this->assertInstanceOf('Shanty_Mongo_DocumentSet', $article->relatedArticles);
     $this->assertInstanceOf('My_ShantyMongo_Article', $article->relatedArticles[0]);
     $this->assertEquals('102 reasons mongo is the bomb digidy', $article->relatedArticles[0]->title);
     $this->assertEquals('103 reasons mongo is the bomb digidy', $article->relatedArticles[0]->relatedArticles[0]->title);
     $exportedData = $article->export();
     $this->assertEquals('102 reasons mongo is the bomb digidy', $exportedData['relatedArticles'][0]['title']);
 }
Esempio n. 4
0
 /**
  * This is to test a really obscure issue where DBRefs get save with null fields.
  **/
 public function testCleanDbRef()
 {
     $user = new My_ShantyMongo_User();
     $user->name = new My_ShantyMongo_Name(array('first' => 'Tom', 'last' => 'Holder'));
     $user->email = '*****@*****.**';
     $user->sex = 'M';
     $user->save();
     $var = $user->name->first;
     $article = new My_ShantyMongo_Article();
     $article->title = 'DBRefs should be clean';
     $article->author = $user;
     $article->save();
     $article = My_ShantyMongo_Article::find($article->getId());
     $exportedArticle = $article->export();
     //This key shouldn't be left behind on field which should be a DBRef.
     $this->assertArrayNotHasKey('name', $exportedArticle['author']);
 }