예제 #1
0
 public function testStaticCreateReturnsObjectAfterInsert()
 {
     // the return value from the find
     $collectionName = 'users';
     $userData = $this->getUserData(array('created_at' => new \MongoDate(time())));
     unset($userData['_id']);
     $this->connectionMock->expects($this->once())->method('insert')->with($collectionName, $userData);
     $user = UserUnit::create($userData);
     $this->assertTrue($user instanceof UserUnit);
     // created_at timestamp
     $this->assertEquals(date('Y-m-d H:i:s', $user->created_at->sec), date('Y-m-d H:i:s'));
 }