/** * @depends initialize */ public function testMapReduceUpdate($pk) { $this->sut->execute(); $user = $this->repository->findByPk($pk); $this->assertEquals(3, $user->getProfile()->publishingCounter, "3 publish for kirk user"); $this->assertEquals(3, $user->getProfile()->commentaryCounter, 'kirk user comments its own publish'); $this->assertEquals(12, $user->getProfile()->likeCounter, "others like kirk's publish and kirk's comment"); return $pk; }
/** * @expectedException \DomainException * @expectedExceptionMessage stdClass is not Persistable */ public function testNotRestoringNonPersistable() { $collection = $this->getMockBuilder('MongoCollection')->disableOriginalConstructor()->setMethods(array('findOne'))->getMock(); $collection->expects($this->once())->method('findOne')->will($this->returnValue(array('_id' => $this->getMock('MongoId')))); $factory = $this->getMockBuilder('Trismegiste\\Alkahest\\Transform\\Transformer')->disableOriginalConstructor()->getMock(); $factory->expects($this->once())->method('create')->will($this->returnValue(new \stdClass())); $repo = new Repository($collection, $factory); $repo->findByPk('49a702d5450046d3d515d10d'); }
/** * @depends initialize */ public function testMapReduceUpdate($userPk) { $this->sut->execute(); $user = $this->repository->findByPk($userPk); $this->assertEquals(3, $user->getProfile()->publishingCounter); }