/** * @covers ../../../src/Library/Helper/File::write() */ public function test_write() { $this->checkNoArg('remove'); \Library\Helper\Directory::ensureExists(self::$tmp_dir); \Library\Helper\File::touch(self::$tmp_file); $logs = array(); $this->assertTrue(\Library\Helper\File::write(self::$tmp_file, $this->lorem_ipsum)); $this->assertEmpty($logs); $ctt = trim(file_get_contents(self::$tmp_file)); $this->assertEquals($this->lorem_ipsum, $ctt); }
public function generate() { $this->_init(); $logs = array(); // loop over each characters letter for ($j = 0; $j < count($this->characters); $j++) { $l = $this->characters[$j]; // loop to create string in length [min;max] for ($i = $this->min_length; $i <= $this->max_length; $i++) { $str = str_pad($l, $i, $l); FileHelper::write($this->rainbow_file, $this->doProcess($str, $this->closure) . "\t" . $str . "\n", 'a+', true, $logs); } } return $logs; }