protected function benchmark(Netizen $user, $counter) { $key = $user->getUsername(); $stopwatch = microtime(true); for ($k = 0; $k < $counter; $k++) { $this->repository->persist($user); } printf(" write %s %.1f ms\n", $key, (microtime(true) - $stopwatch) * 1000 / $counter); $stopwatch = microtime(true); for ($k = 0; $k < $counter; $k++) { $user = $this->repository->findByNickname($key); } printf(" read %s %.1f ms\n", $user->getUsername(), (microtime(true) - $stopwatch) * 1000 / $counter); }
public function testUsernameAuthor() { $this->author->expects($this->once())->method('getNickname')->will($this->returnValue('kirk')); $this->assertEquals('kirk', $this->sut->getUsername()); }