Skip to content

Commit

Permalink
Merge pull request #3 from solocommand/master
Browse files Browse the repository at this point in the history
Ensure that file contents are actually written correctly.
  • Loading branch information
solocommand committed Feb 20, 2017
2 parents 5e66121 + 448a06c commit ce9c713
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/StorageEngine/LocalStorageEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function store(Asset $asset, $path = null, $filename = null)
throw new StorageException($error['message']);
}

file_put_contents($key, $asset);
file_put_contents($key, file_get_contents($asset));

return true;
}
Expand Down
6 changes: 6 additions & 0 deletions tests/StorageEngine/AbstractStorageEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public function testEngineRetrieval()
$this->assertInstanceOf('Limit0\Assets\Asset', $asset);
}

public function testFileContents()
{
$asset = self::$engine->retrieve($this->getTestIdentifier());
$this->assertSame(file_get_contents($this->getTestAsset()), file_get_contents($asset), 'StorageEngine did not store file contents properly.');
}

public function testEngineRemoval()
{
$result = self::$engine->remove($this->getTestIdentifier());
Expand Down

0 comments on commit ce9c713

Please sign in to comment.