Skip to content

Commit

Permalink
Provide a simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
mfn committed Sep 17, 2020
1 parent 9ea2b0e commit d6d256d
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/end-to-end/tests-xml-dataprovider.phpt
@@ -0,0 +1,48 @@
--TEST--
phpunit --list-tests-xml ../../_files/DataProviderTest.php
--FILE--
<?php declare(strict_types=1);
$xml = tempnam(sys_get_temp_dir(), __FILE__);
file_put_contents($xml, <<<XML
<?xml version="1.0"?>
<tests>
<!-- This class exists -->
<testCaseClass name="PHPUnit\TestFixture\DataProviderTest">
<testCaseMethod name="testAdd" groups="default" dataSet="#0"/>
<!-- This method does not exist -->
<testCaseMethod name="methodDoesNotExist"/>
<!-- name attribute missing -->
<testCaseMethod />
</testCaseClass>
<!-- name attribute missing -->
<testCaseClass>
<testCaseMethod name="testAdd" groups="default" dataSet="#0"/>
</testCaseClass>
<ignoredTag/>
<testCaseClass name="Class\Does\Not\Exist">
<testCaseMethod name="methodAlsoDoesNotExist"/>
</testCaseClass>
</tests>
XML
);

$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--tests-xml';
$_SERVER['argv'][3] = $xml;
$_SERVER['argv'][4] = __DIR__ . '/../_files/DataProviderTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main(false);

unlink($xml);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

. 1 / 1 (100%)

Time: %s, Memory: %s

OK (1 test, 1 assertion)

0 comments on commit d6d256d

Please sign in to comment.