/** * Adding some fake contacts */ private function addSomeContacts() { $generator = $this->getMockBuilder(Generator::class)->getMock(); $generator->method('generateId')->will($this->onConsecutiveCalls('ac1245csd', '154ecdf817')); $this->contactBookManager->setGenerator($generator); $john = $this->contactBookManager->create('John Doe', '0659111700'); $jane = $this->contactBookManager->create('Jane Doe', '0609187010'); $this->contactBook->add($john); $this->contactBook->add($jane); }
/** * @test * @covers ::__construct * @covers ::add * @covers ::create * @covers ::count * @covers ::setGenerator * @uses App\ContactBook * @uses App\ContactNotFoundException * @uses App\Contact * @uses App\Generator */ public function should_return_all_number_of_contacts() { $this->addSomeContacts(); $count = $this->contactBookManager->count(); $this->assertEquals(2, $count); }