Commit 1402c663 authored by alexpott's avatar alexpott

Issue #2096595 by neclimdul, damiankloip, tim.plunkett, Mile23, ParisLiakos:...

Issue #2096595 by neclimdul, damiankloip, tim.plunkett, Mile23, ParisLiakos: Make all PHPUnit tests pass with --strict.
parent cf8c025b
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php" colors="true"> <phpunit bootstrap="tests/bootstrap.php" colors="true" strict="true">
<testsuites> <testsuites>
<testsuite name="Drupal Unit Test Suite"> <testsuite name="Drupal Unit Test Suite">
<directory>./tests/*</directory> <directory>./tests/*</directory>
......
...@@ -57,6 +57,9 @@ function testCRUD() { ...@@ -57,6 +57,9 @@ function testCRUD() {
* *
* We test two attacks: first changes the file mtime, then the directory * We test two attacks: first changes the file mtime, then the directory
* mtime too. * mtime too.
*
* We need to delay over 1 second for mtime test.
* @medium
*/ */
function testSecurity() { function testSecurity() {
$php = $this->storageFactory->get('simpletest'); $php = $this->storageFactory->get('simpletest');
......
...@@ -153,7 +153,7 @@ function setUp() { ...@@ -153,7 +153,7 @@ function setUp() {
* *
* @see testRender * @see testRender
*/ */
function testRenderProvider() { function providerTestRender() {
// Default for 'browsers' key in CSS asset. // Default for 'browsers' key in CSS asset.
$browsers_default = array('IE' => TRUE, '!IE' => TRUE); $browsers_default = array('IE' => TRUE, '!IE' => TRUE);
...@@ -538,7 +538,7 @@ function testRenderProvider() { ...@@ -538,7 +538,7 @@ function testRenderProvider() {
/** /**
* Tests CSS asset rendering. * Tests CSS asset rendering.
* *
* @dataProvider testRenderProvider * @dataProvider providerTestRender
*/ */
function testRender(array $css_assets, array $render_elements) { function testRender(array $css_assets, array $render_elements) {
$this->state->expects($this->once()) $this->state->expects($this->once())
......
...@@ -86,7 +86,7 @@ function setUp() { ...@@ -86,7 +86,7 @@ function setUp() {
/** /**
* Provides data for the CSS asset optimizing test. * Provides data for the CSS asset optimizing test.
*/ */
function testOptimizeProvider() { function providerTestOptimize() {
$path = dirname(__FILE__) . '/css_test_files/'; $path = dirname(__FILE__) . '/css_test_files/';
return array( return array(
// File. Tests: // File. Tests:
...@@ -194,7 +194,7 @@ function testOptimizeProvider() { ...@@ -194,7 +194,7 @@ function testOptimizeProvider() {
/** /**
* Tests optimizing a CSS asset group containing 'type' => 'file'. * Tests optimizing a CSS asset group containing 'type' => 'file'.
* *
* @dataProvider testOptimizeProvider * @dataProvider providerTestOptimize
*/ */
function testOptimize($css_asset, $expected) { function testOptimize($css_asset, $expected) {
$this->assertEquals($expected, $this->optimizer->optimize($css_asset), 'Group of file CSS assets optimized correctly.'); $this->assertEquals($expected, $this->optimizer->optimize($css_asset), 'Group of file CSS assets optimized correctly.');
......
...@@ -39,10 +39,11 @@ function testEmpty() { ...@@ -39,10 +39,11 @@ function testEmpty() {
function testEmptyIteration() { function testEmptyIteration() {
$result = new StatementEmpty(); $result = new StatementEmpty();
$count = 0;
foreach ($result as $record) { foreach ($result as $record) {
$this->fail('Iterating empty result set should not iterate.'); $count++;
return;
} }
$this->assertSame(0, $count, 'Iterating empty result set should not iterate.');
} }
/** /**
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
use Drupal\Core\Extension\ModuleHandler; use Drupal\Core\Extension\ModuleHandler;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
use PHPUnit_Framework_Error_Notice;
/** /**
* Tests the ModuleHandler class. * Tests the ModuleHandler class.
...@@ -34,9 +35,12 @@ function setUp() { ...@@ -34,9 +35,12 @@ function setUp() {
$this->moduleHandler = new ModuleHandler; $this->moduleHandler = new ModuleHandler;
} }
function testloadInclude() { /**
// Make sure that load include does not throw notices on nonexisiting * Tests loading of an include from a nonexistent module.
// modules. */
$this->moduleHandler->loadInclude('foo', 'inc'); public function testLoadInclude() {
// Attepmting to load a file from a non-existent module should return FALSE.
$this->assertFalse($this->moduleHandler->loadInclude('foo', 'inc'));
} }
} }
...@@ -52,6 +52,9 @@ public function testWaitFalse() { ...@@ -52,6 +52,9 @@ public function testWaitFalse() {
/** /**
* Tests the wait() method when lockMayBeAvailable() returns FALSE. * 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() { public function testWaitTrue() {
$this->lock->expects($this->any()) $this->lock->expects($this->any())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment