[HttpKernel] fixed some unit tests

This commit is contained in:
Fabien Potencier 2011-11-07 22:31:47 +01:00
parent 47fca8e0a0
commit 18c6a86291
2 changed files with 6 additions and 3 deletions

View File

@ -146,10 +146,13 @@ class FileProfilerStorage implements ProfilerStorageInterface
'url' => $profile->getUrl(),
'time' => $profile->getTime(),
);
file_put_contents($file, serialize($data));
if (false === file_put_contents($file, serialize($data))) {
return false;
}
// Add to index
if (false === $file = fopen($this->getIndexFilename(), 'w')) {
if (false === $file = fopen($this->getIndexFilename(), 'a')) {
return false;
}

View File

@ -123,7 +123,7 @@ class FileProfilerStorageTest extends \PHPUnit_Framework_TestCase
$profile = new Profile('token');
$this->assertTrue(true === self::$storage->write($profile), '->write() returns true when the token is unique');
$this->assertTrue(false === self::$storage->write($profile), '->write() return false when the token is already present in the DB');
$this->assertTrue(true === self::$storage->write($profile), '->write() overwrites when the token is already present in the DB');
}
public function testRetrieveByIp()