public function testWriteFromScratchShouldWriteToAFile() { $mockTextFile = m::mock(TextFile::class); $mockTextFile->shouldReceive("write")->with("hasan gilak")->once(); $mockTextFile->shouldReceive("extractAgainAllLinesIntoArray")->once(); $this->textChains->setFile($mockTextFile); $this->textChains->writeFromScratch("hasan gilak"); }