Skip to content
Browse files

Fixed Gaufrette compatibility for empty blobs

  • Loading branch information...
1 parent 05c6313 commit 1dabcfb13ed24b6f8d4a33921e39920bf50f9aa1 @magnusnordlander magnusnordlander committed Mar 19, 2013
Showing with 7 additions and 2 deletions.
  1. +2 −2 src/Gittern/Entity/GitObject/Blob.php
  2. +5 −0 tests/Gittern/Entity/GitObject/BlobTest.php
View
4 src/Gittern/Entity/GitObject/Blob.php
@@ -23,11 +23,11 @@ public function getSha()
public function setContents($contents)
{
- $this->contents = $contents;
+ $this->contents = (string) $contents;
}
public function getContents()
{
- return $this->contents;
+ return (string) $this->contents;
}
}
View
5 tests/Gittern/Entity/GitObject/BlobTest.php
@@ -28,4 +28,9 @@ public function testCanSetAndGetContents()
$this->blob->setContents('foobar');
$this->assertEquals('foobar', $this->blob->getContents());
}
+
+ public function testContentsAreAlwaysStrings()
+ {
+ $this->assertSame('', $this->blob->getContents());
+ }
}

0 comments on commit 1dabcfb

Please sign in to comment.
Something went wrong with that request. Please try again.