Skip to content

Commit

Permalink
Newline cache file content
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelstolt committed Oct 10, 2016
1 parent ec7f8bc commit 6931281
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions 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.
2 changes: 1 addition & 1 deletion src/Travis.php
Expand Up @@ -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) {
Expand Down
16 changes: 15 additions & 1 deletion tests/TestCase.php
Expand Up @@ -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);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions tests/TravisTest.php
Expand Up @@ -267,6 +267,10 @@ public function successfulLintCreatesCacheFile()

$this->assertTrue(Travis::lint($eventMock, $apiMock));
$this->assertComposerTravisLintCacheFileExists();
$this->assertEquals(
md5($travisConfiguration) . "\n",
$this->getComposerTravisLintCacheFileContent()
);
}

/**
Expand Down

0 comments on commit 6931281

Please sign in to comment.