public function testSaveUpdatesWhenPassingArrayValues() { // ================ // prepare User // this is our User we'll be saving, note we set the _id as this // is required to ensure it's an update() - not a insert() .. usually // this would be set internally by load() during a find/findOne() call $user = new UserUnit(); $user->_id = new \MongoId(); // this is the data we'll pass to save() $saveData = $this->getUserData(array(), false); // no _id // ================ // mock $this->connectionMock->expects($this->once())->method('update')->with('users', array('_id' => $user->_id), array('$set' => array_merge($saveData, array('updated_at' => new \MongoDate(time())))), array('multi' => false)); // ================ // run test $user->save($saveData); }