/** * @depends testInvalidFilename */ public function testTimestamp() { $obj = new File(); $obj->setFilename($this->_testFileName); $obj->addTimestamp()->setFieldDelimiter(' ')->write("Test message 1"); $obj->addTimestamp()->setFieldDelimiter(':')->write("Test message 2"); $expected = sprintf("%s Test message 1\n%s:Test message 2\n", date("Y/m/d H:i:s"), date("Y/m/d H:i:s")); $this->assertStringEqualsFile($this->_testFileName, $expected); }
/** * @param $filename string filename where the file will be created or appended * * @static * @return File * @throws \Exception */ public static function File($filename) { try { $oComms = new File(); $oComms->setFilename($filename); return $oComms; } catch (\Exception $ex) { throw $ex; } }