示例#1
0
 public function testReplaceALine()
 {
     $mockTextFile = m::mock(TextFile::class);
     $mockTextFile->shouldReceive("extractAgainAllLinesIntoArray")->once();
     $mockTextFile->shouldReceive("getLine")->with(0)->once()->andReturn("hasan gilak");
     $mockTextFile->shouldReceive("getAllLines")->once()->andReturn(["hasan gilak"]);
     $mockTextFile->shouldReceive("write")->with("elyas gilak")->once();
     $this->textChains->setFile($mockTextFile);
     $this->textChains->replaceALine(0, "elyas gilak");
 }
示例#2
0
 /**
  * @param $fileAddress
  * @return TextChains
  */
 public function text($fileAddress)
 {
     $text = $this->text->setFile(new TextFile($fileAddress));
     $text->getFile()->isSafeForOperations();
     return $text;
 }