protected function setUp()
 {
     parent::setUp();
     Route::clear();
     $this->path = Path::joinWithTemp(uniqid() . '_generated_uri_helper.js');
     Config::overrideProperty("global", "prefix_system")->with("/app");
 }
示例#2
0
 public function setUp()
 {
     $this->directory = Path::joinWithTemp('directory_class');
     mkdir($this->directory, 0777, true);
     file_put_contents(Path::join($this->directory, 'file1.txt'), 'test');
     file_put_contents(Path::join($this->directory, 'file2.txt'), 'some new file');
 }
示例#3
0
 /**
  * @test
  */
 public function shouldJoinPathWithTempDirectory()
 {
     // given
     $s = DIRECTORY_SEPARATOR;
     $tmp = sys_get_temp_dir();
     // when
     $path = Path::joinWithTemp('my/file.txt');
     // then
     $this->assertEquals("{$tmp}{$s}my{$s}file.txt", $path);
 }
示例#4
0
 /**
  * @test
  */
 public function shouldSaveGeneratedUriHelperInFile()
 {
     //given
     Route::resource('users');
     $fileName = uniqid() . '_GeneratedUriHelper.php';
     $path = Path::joinWithTemp($fileName);
     $generator = UriHelperGenerator::generate();
     //when
     $generator->saveToFile($path);
     //then
     $this->assertFileExists($path);
     $this->assertEquals($generator->getGeneratedFunctions(), file_get_contents($path));
     unlink($path);
 }
示例#5
0
 protected function setUp()
 {
     parent::setUp();
     $this->path = Path::joinWithTemp('users');
 }
示例#6
0
 /**
  * @test
  */
 public function shouldDeleteFileIfExists()
 {
     //given
     $filePath = Path::joinWithTemp('files_test');
     file_put_contents($filePath, 'test');
     //when
     $isDeleted = Files::deleteIfExists($filePath);
     //then
     $this->assertTrue($isDeleted);
     $this->assertFileNotExists($filePath);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->controllerPath = Path::joinWithTemp('UsersController.php');
 }