Skip to content

Commit

Permalink
Merge pull request doctrine#235 from lcobucci/upgrade-phpunit
Browse files Browse the repository at this point in the history
Upgrade PHPUnit
  • Loading branch information
Ocramius authored Aug 25, 2017
2 parents cf2997d + 606ec9f commit beb0fa3
Show file tree
Hide file tree
Showing 20 changed files with 225 additions and 224 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
"require-dev": {
"alcaeus/mongo-php-adapter": "^1.1",
"mongodb/mongodb": "^1.1",
"phpunit/phpunit": "^5.7",
"phpunit/phpunit": "^6.3",
"predis/predis": "~1.0",
"squizlabs/php_codesniffer": "^3.0",
"doctrine/coding-standard": "^1.0"
},
"suggest": {
Expand Down
14 changes: 7 additions & 7 deletions tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function testGetStats() : void
$cache->fetch('test3');

$stats = $cache->getStats();
$this->assertEquals(2, $stats[Cache::STATS_HITS]);
$this->assertEquals(5, $stats[Cache::STATS_MISSES]); // +1 for internal call to DoctrineNamespaceCacheKey
$this->assertNotNull($stats[Cache::STATS_UPTIME]);
$this->assertNull($stats[Cache::STATS_MEMORY_USAGE]);
$this->assertNull($stats[Cache::STATS_MEMORY_AVAILABLE]);
self::assertEquals(2, $stats[Cache::STATS_HITS]);
self::assertEquals(5, $stats[Cache::STATS_MISSES]); // +1 for internal call to DoctrineNamespaceCacheKey
self::assertNotNull($stats[Cache::STATS_UPTIME]);
self::assertNull($stats[Cache::STATS_MEMORY_USAGE]);
self::assertNull($stats[Cache::STATS_MEMORY_AVAILABLE]);

$cache->delete('test1');
$cache->delete('test2');
Expand All @@ -42,8 +42,8 @@ public function testGetStats() : void
$cache->fetch('test3');

$stats = $cache->getStats();
$this->assertEquals(2, $stats[Cache::STATS_HITS]);
$this->assertEquals(8, $stats[Cache::STATS_MISSES]); // +1 for internal call to DoctrineNamespaceCacheKey
self::assertEquals(2, $stats[Cache::STATS_HITS]);
self::assertEquals(8, $stats[Cache::STATS_MISSES]); // +1 for internal call to DoctrineNamespaceCacheKey
}

protected function isSharedStorage() : bool
Expand Down
16 changes: 8 additions & 8 deletions tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public function testFlushAllRemovesBalancingDirectories() : void
{
$cache = $this->_getCacheDriver();

$this->assertTrue($cache->save('key1', 1));
$this->assertTrue($cache->save('key2', 2));
$this->assertTrue($cache->flushAll());
self::assertTrue($cache->save('key1', 1));
self::assertTrue($cache->save('key2', 2));
self::assertTrue($cache->flushAll());

$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST);

$this->assertCount(0, $iterator);
self::assertCount(0, $iterator);
}

protected function isSharedStorage() : bool
Expand Down Expand Up @@ -117,7 +117,7 @@ public function testWindowsPathLengthLimitIsCorrectlyHandled(int $length, bool $

list($key, $keyPath, $hashedKeyPath) = self::getKeyAndPathFittingLength($length, $this->directory);

$this->assertEquals($length, strlen($keyPath), 'Unhashed path should be of correct length.');
self::assertEquals($length, strlen($keyPath), 'Unhashed path should be of correct length.');

$cacheClass = get_class($this->_getCacheDriver());
/* @var $cache \Doctrine\Common\Cache\FileCache */
Expand All @@ -133,13 +133,13 @@ public function testWindowsPathLengthLimitIsCorrectlyHandled(int $length, bool $
$value = uniqid('value', true);

$cache->save($key, $value);
$this->assertEquals($value, $cache->fetch($key));
self::assertEquals($value, $cache->fetch($key));

if ($pathShouldBeHashed) {
$this->assertFileExists($hashedKeyPath, 'Path generated for key should be hashed.');
self::assertFileExists($hashedKeyPath, 'Path generated for key should be hashed.');
unlink($hashedKeyPath);
} else {
$this->assertFileExists($keyPath, 'Path generated for key should not be hashed.');
self::assertFileExists($keyPath, 'Path generated for key should not be hashed.');
unlink($keyPath);
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/Common/Cache/CacheProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testFetchMultiWillFilterNonRequestedKeys() : void
'[baz][1]' => 'tab',
]));

$this->assertEquals(
self::assertEquals(
['foo' => 'bar', 'bar' => 'baz'],
$cache->fetchMultiple(['foo', 'bar'])
);
Expand Down Expand Up @@ -68,7 +68,7 @@ public function testFailedDeleteAllDoesNotChangeNamespaceVersion() : void
->with('[key][1]')
->will($this->returnValue(true));

$this->assertFalse($cache->deleteAll(), 'deleteAll() returns false when saving the namespace version fails');
self::assertFalse($cache->deleteAll(), 'deleteAll() returns false when saving the namespace version fails');
$cache->contains('key');
}

Expand Down
Loading

0 comments on commit beb0fa3

Please sign in to comment.