From 69312812aec457c53ac7711d20b70c953fa7498d Mon Sep 17 00:00:00 2001 From: Raphael Stolt Date: Mon, 10 Oct 2016 20:48:24 +0200 Subject: [PATCH] Newline cache file content --- CHANGELOG.md | 3 +++ src/Travis.php | 2 +- tests/TestCase.php | 16 +++++++++++++++- tests/TravisTest.php | 4 ++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e56b32..8dedba2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +#### v1.0.1 `2016-10-10` +- Add a newline to the cache file content. + #### v1.0.0 `2016-10-09` - Initial release. diff --git a/src/Travis.php b/src/Travis.php index 77fa1e1..1743a72 100644 --- a/src/Travis.php +++ b/src/Travis.php @@ -84,7 +84,7 @@ public static function lint(Event $event, Api $api = null) $bytesWritten = file_put_contents( $composerTravisLintCache, - md5($travisConfigContent) + md5($travisConfigContent) . "\n" ); if ($bytesWritten > 0) { diff --git a/tests/TestCase.php b/tests/TestCase.php index 83709a2..7e85c83 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -92,7 +92,21 @@ protected function createComposerTravisLintCacheFile($content) . DIRECTORY_SEPARATOR . '.ctl.cache'; - file_put_contents($this->composerTravisLintCacheFile, md5($content)); + file_put_contents($this->composerTravisLintCacheFile, md5($content) . "\n"); + } + + /** + * Get the .ctl.cache content. + * + * @return string + */ + protected function getComposerTravisLintCacheFileContent() + { + $this->composerTravisLintCacheFile = $this->temporaryDirectory + . DIRECTORY_SEPARATOR + . '.ctl.cache'; + + return file_get_contents($this->composerTravisLintCacheFile); } /** diff --git a/tests/TravisTest.php b/tests/TravisTest.php index e81fe15..c27260c 100644 --- a/tests/TravisTest.php +++ b/tests/TravisTest.php @@ -267,6 +267,10 @@ public function successfulLintCreatesCacheFile() $this->assertTrue(Travis::lint($eventMock, $apiMock)); $this->assertComposerTravisLintCacheFileExists(); + $this->assertEquals( + md5($travisConfiguration) . "\n", + $this->getComposerTravisLintCacheFileContent() + ); } /**