Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / simpletest / tests / src / Unit / PhpUnitErrorTest.php
1 <?php
2
3 namespace Drupal\Tests\simpletest\Unit;
4
5 use Drupal\Tests\UnitTestCase;
6
7 /**
8  * Tests PHPUnit errors are getting converted to Simpletest errors.
9  *
10  * @group simpletest
11  */
12 class PhpUnitErrorTest extends UnitTestCase {
13
14   /**
15    * Test errors reported.
16    *
17    * @covers ::simpletest_phpunit_xml_to_rows
18    */
19   public function testPhpUnitXmlParsing() {
20     require_once __DIR__ . '/../../../simpletest.module';
21
22     $phpunit_error_xml = __DIR__ . '/../../fixtures/phpunit_error.xml';
23
24     $res = simpletest_phpunit_xml_to_rows(1, $phpunit_error_xml);
25     $this->assertEquals(count($res), 4, 'All testcases got extracted');
26     $this->assertNotEquals($res[0]['status'], 'pass');
27     $this->assertEquals($res[0]['status'], 'fail');
28
29     // Test nested testsuites, which appear when you use @dataProvider.
30     for ($i = 0; $i < 3; $i++) {
31       $this->assertNotEquals($res[$i + 1]['status'], 'pass');
32       $this->assertEquals($res[$i + 1]['status'], 'fail');
33     }
34
35     // Make sure simpletest_phpunit_xml_to_rows() does not balk if the test
36     // didn't run.
37     simpletest_phpunit_xml_to_rows(1, 'foobar');
38   }
39
40 }