/**
  * @Given file :name exists
  * @Given dir :name exists
  * @Given file :name exists with content:
  * @Given I write :name with content:
  */
 public function fileExistsWithContent($name, PyStringNode $string = null)
 {
     if (null === $string) {
         $this->filesystem->createFile($name);
     } else {
         $this->filesystem->write($name, $string->__toString(), true);
     }
 }
예제 #2
0
 /**
  * @param mixed $data
  * @param int $mode
  * @return int
  */
 public function write($data, $mode = 0)
 {
     if ($mode & FILE_APPEND) {
         $data = $this->read() . $data;
     }
     if (!$this->gaufrette->has($this->filePath)) {
         $this->gaufrette->createFile($this->filePath);
     }
     return $this->gaufrette->write($this->filePath, $data, true);
 }
 /**
  * @test
  * @group functional
  */
 public function shouldWrtieToSameFile()
 {
     $FileObjectA = $this->filesystem->createFile('somefile');
     $FileObjectA->setContent('ABC');
     $FileObjectB = $this->filesystem->createFile('somefile');
     $FileObjectB->setContent('DEF');
     $this->assertEquals('DEF', $FileObjectB->getContent());
     $this->filesystem->delete('somefile');
 }