diff --git a/src/Task/Development/SemVer.php b/src/Task/Development/SemVer.php index 1c021baf8..f1c0ffce8 100644 --- a/src/Task/Development/SemVer.php +++ b/src/Task/Development/SemVer.php @@ -226,6 +226,7 @@ protected function dump() if (empty($this->path)) { return true; } + $semver = sprintf( self::SEMVER, $this->version['major'], @@ -234,7 +235,8 @@ protected function dump() $this->version['special'], $this->version['metadata'] ); - if (is_writeable($this->path) === false || file_put_contents($this->path, $semver) === false) { + + if (file_put_contents($this->path, $semver) === false) { throw new TaskException($this, 'Failed to write semver file.'); } return true; diff --git a/tests/integration/SemVerTest.php b/tests/integration/SemVerTest.php new file mode 100644 index 000000000..57dd9a9db --- /dev/null +++ b/tests/integration/SemVerTest.php @@ -0,0 +1,43 @@ +fixtures = new Fixtures(); + $this->initTestTasksTrait(); + } + + public function tearDown() + { + $this->fixtures->cleanup(); + } + + public function testSemVerFileWrite() + { + $this->fixtures->createAndCdToSandbox(); + + $sampleCss = $this->fixtures->dataFile('sample.css'); + + $outputFile = '.semver'; + + $result = $this->taskSemVer($outputFile) + ->increment() + ->run(); + + $this->assertTrue($result->wasSuccessful(), $result->getMessage()); + + $this->assertFileExists($outputFile); + $outputFileContents = file_get_contents($outputFile); + $this->assertContains('major', $outputFileContents, 'Semver file has expected structure'); + } +}