8000 minor #19544 [Cache] Skip tests that sleep() but can't be clock-mocke… · symfony/symfony@49a2cb8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 49a2cb8

Browse files
minor #19544 [Cache] Skip tests that sleep() but can't be clock-mocked (nicolas-grekas)
This PR was merged into the 3.1 branch. Discussion ---------- [Cache] Skip tests that sleep() but can't be clock-mocked | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Skip tests that require real calls to `sleep()`: they slow down the test suite too much and don't test much. `@group time-sensitive` tests will run these test cases just fine, but they can't be used on tests that use an external source for time, i.e. for redis or apcu. Commits ------- d476725 [Cache] Skip tests that sleep() but can't be clock-mocked
2 parents c45b916 + d476725 commit 49a2cb8

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515

1616
abstract class AbstractRedisAdapterTest extends AdapterTestCase
1717
{
18+
protected $skippedTests = array(
19+
'testExpiration' => 'Testing expiration slows down the test suite',
20+
'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite',
21+
'testDefaultLifeTime' => 'Testing expiration slows down the test suite',
22+
);
23+
1824
protected static $redis;
1925

2026
public function createCachePool($defaultLifetime = 0)

src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515

1616
class ApcuAdapterTest extends AdapterTestCase
1717
{
18+
protected $skippedTests = array(
19+
'testExpiration' => 'Testing expiration slows down the test suite',
20+
'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite',
21+
'testDefaultLifeTime' => 'Testing expiration slows down the test suite',
22+
);
23+
1824
public function createCachePool($defaultLifetime = 0)
1925
{
2026
if (!function_exists('apcu_fetch') || !ini_get('apc.enabled') || ('cli' === PHP_SAPI && !ini_get('apc.enable_cli'))) {

src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
/**
2020
* @author Kévin Dunglas <dunglas@gmail.com>
21+
* @group time-sensitive
2122
*/
2223
class ChainAdapterTest extends AdapterTestCase
2324
{

src/Symfony/Component/Cache/Tests/Adapter/DoctrineAdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ class DoctrineAdapterTest extends AdapterTestCase
2626

2727
public function createCachePool($defaultLifetime = 0)
2828
{
29-
return new DoctrineAdapter(new ArrayCache(), '', $defaultLifetime);
29+
return new DoctrineAdapter(new ArrayCache($defaultLifetime), '', $defaultLifetime);
3030
}
3131
}

src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ class NamespacedProxyAdapterTest extends ProxyAdapterTest
2121
{
2222
public function createCachePool($defaultLifetime = 0)
2323
{
24-
return new ProxyAdapter(new ArrayAdapter(), 'foo', $defaultLifetime);
24+
return new ProxyAdapter(new ArrayAdapter($defaultLifetime), 'foo', $defaultLifetime);
2525
}
2626
}

0 commit comments

Comments
 (0)
0