diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist index 6ca7e89f803..f7c97fc873e 100644 --- a/core/phpunit.xml.dist +++ b/core/phpunit.xml.dist @@ -1,6 +1,6 @@ - + ./tests/* diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php index 3cd1e624691..55d01c8ee09 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php @@ -57,6 +57,9 @@ class MTimeProtectedFileStorageTest extends PhpStorageTestBase { * * We test two attacks: first changes the file mtime, then the directory * mtime too. + * + * We need to delay over 1 second for mtime test. + * @medium */ function testSecurity() { $php = $this->storageFactory->get('simpletest'); diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php index d8e3a329475..bfbe65c2635 100644 --- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php @@ -153,7 +153,7 @@ class CssCollectionRendererUnitTest extends UnitTestCase { * * @see testRender */ - function testRenderProvider() { + function providerTestRender() { // Default for 'browsers' key in CSS asset. $browsers_default = array('IE' => TRUE, '!IE' => TRUE); @@ -538,7 +538,7 @@ class CssCollectionRendererUnitTest extends UnitTestCase { /** * Tests CSS asset rendering. * - * @dataProvider testRenderProvider + * @dataProvider providerTestRender */ function testRender(array $css_assets, array $render_elements) { $this->state->expects($this->once()) diff --git a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php index a077ad53653..2fbf61952de 100644 --- a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php @@ -86,7 +86,7 @@ class CssOptimizerUnitTest extends UnitTestCase { /** * Provides data for the CSS asset optimizing test. */ - function testOptimizeProvider() { + function providerTestOptimize() { $path = dirname(__FILE__) . '/css_test_files/'; return array( // File. Tests: @@ -194,7 +194,7 @@ class CssOptimizerUnitTest extends UnitTestCase { /** * Tests optimizing a CSS asset group containing 'type' => 'file'. * - * @dataProvider testOptimizeProvider + * @dataProvider providerTestOptimize */ function testOptimize($css_asset, $expected) { $this->assertEquals($expected, $this->optimizer->optimize($css_asset), 'Group of file CSS assets optimized correctly.'); diff --git a/core/tests/Drupal/Tests/Core/Database/EmptyStatementTest.php b/core/tests/Drupal/Tests/Core/Database/EmptyStatementTest.php index 9bf2c8071e3..6877a9ce35b 100644 --- a/core/tests/Drupal/Tests/Core/Database/EmptyStatementTest.php +++ b/core/tests/Drupal/Tests/Core/Database/EmptyStatementTest.php @@ -39,10 +39,11 @@ class EmptyStatementTest extends UnitTestCase { function testEmptyIteration() { $result = new StatementEmpty(); + $count = 0; foreach ($result as $record) { - $this->fail('Iterating empty result set should not iterate.'); - return; + $count++; } + $this->assertSame(0, $count, 'Iterating empty result set should not iterate.'); } /** diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php index 45ad0d26369..49ab1f83c9b 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php @@ -13,6 +13,7 @@ if (!defined('DRUPAL_ROOT')) { use Drupal\Core\Extension\ModuleHandler; use Drupal\Tests\UnitTestCase; +use PHPUnit_Framework_Error_Notice; /** * Tests the ModuleHandler class. @@ -34,9 +35,12 @@ class ModuleHandlerUnitTest extends UnitTestCase { $this->moduleHandler = new ModuleHandler; } - function testloadInclude() { - // Make sure that load include does not throw notices on nonexisiting - // modules. - $this->moduleHandler->loadInclude('foo', 'inc'); + /** + * Tests loading of an include from a nonexistent module. + */ + public function testLoadInclude() { + // Attepmting to load a file from a non-existent module should return FALSE. + $this->assertFalse($this->moduleHandler->loadInclude('foo', 'inc')); } + } diff --git a/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php index 933f8b5fbfa..2ce4ef7fe01 100644 --- a/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php +++ b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php @@ -52,6 +52,9 @@ class LockBackendAbstractTest extends UnitTestCase { /** * Tests the wait() method when lockMayBeAvailable() returns FALSE. + * + * Waiting could take 1 second so we need to extend the possible runtime. + * @medium */ public function testWaitTrue() { $this->lock->expects($this->any())