diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist index 6ca7e89f8031554de11dc5324cb4de72272efa6c..f7c97fc873e74717b83e14fd5158643ed0e00b70 100644 --- a/core/phpunit.xml.dist +++ b/core/phpunit.xml.dist @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<phpunit bootstrap="tests/bootstrap.php" colors="true"> +<phpunit bootstrap="tests/bootstrap.php" colors="true" strict="true"> <testsuites> <testsuite name="Drupal Unit Test Suite"> <directory>./tests/*</directory> diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php index 3cd1e6246918069db807528b7867cea582e1f0c0..55d01c8ee09402d86063505be96e6d069ae11feb 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php @@ -57,6 +57,9 @@ function testCRUD() { * * 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 d8e3a3294753df23dfc870c8f831fd0af52db426..bfbe65c2635486f3069d333944181e6ae8159086 100644 --- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php @@ -153,7 +153,7 @@ function setUp() { * * @see testRender */ - function testRenderProvider() { + function providerTestRender() { // Default for 'browsers' key in CSS asset. $browsers_default = array('IE' => TRUE, '!IE' => TRUE); @@ -538,7 +538,7 @@ function testRenderProvider() { /** * 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 a077ad536539cdf939b4ef88b400135124863a1e..2fbf61952de6c89cee10b9063dbe6bbd8204d6fc 100644 --- a/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php @@ -86,7 +86,7 @@ function setUp() { /** * 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 @@ function testOptimizeProvider() { /** * 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 9bf2c8071e392ab0b784a65a8f8e598db95cc099..6877a9ce35bf169815941177206f34a660aff751 100644 --- a/core/tests/Drupal/Tests/Core/Database/EmptyStatementTest.php +++ b/core/tests/Drupal/Tests/Core/Database/EmptyStatementTest.php @@ -39,10 +39,11 @@ function testEmpty() { 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 45ad0d26369f0090e8aae4f3b34fe87898e96cc3..49ab1f83c9b824caefa0215ae7e556c3ae183b19 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php @@ -13,6 +13,7 @@ use Drupal\Core\Extension\ModuleHandler; use Drupal\Tests\UnitTestCase; +use PHPUnit_Framework_Error_Notice; /** * Tests the ModuleHandler class. @@ -34,9 +35,12 @@ function setUp() { $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 933f8b5fbfaaa593a8c2ab0921f10f08f0abcd4f..2ce4ef7fe018757dd30e7b604458789b695f5ba7 100644 --- a/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php +++ b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php @@ -52,6 +52,9 @@ public function testWaitFalse() { /** * 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())