public function test_can_write()
 {
     $writer = new FileWriter();
     $writer->write('contents', 'filename', __DIR__ . '/../stubs/migrations');
     $this->assertEquals('contents', file_get_contents(__DIR__ . '/../stubs/migrations/filename.php'));
     // delete old files
     unlink(__DIR__ . '/../stubs/migrations/filename.php');
 }
 /**
  * @param Configuration $configuration
  * @param bool          $create
  * @param bool          $update
  * @param null          $up
  * @param null          $down
  *
  * @return string
  */
 public function generate(Configuration $configuration, $create = false, $update = false, $up = null, $down = null)
 {
     $stub = $this->getStub($create, $update);
     $contents = $this->locator->locate($stub)->get();
     $contents = $this->replacer->replace($contents, $this->variables, [$configuration->getMigrationsNamespace(), $configuration->getNamingStrategy()->getClassName(), $this->getTableName($create, $update), $up ? $this->tabbedNewLine($up) : null, $down ? $this->tabbedNewLine($down) : null]);
     $filename = $configuration->getNamingStrategy()->getFilename();
     $this->writer->write($contents, $filename, $configuration->getMigrationsDirectory());
     return $filename;
 }