Skip to content

Commit

Permalink
Test for data provider declaring class
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored and sebastianbergmann committed Nov 10, 2017
1 parent 58cdc63 commit 7e8e262
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/TextUI/dataprovider-pair.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
phpunit ../_files/DataProviderPair
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/DataProviderPair';

require __DIR__ . '/../bootstrap.php';
PHPUnit_TextUI_Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

.. 2 / 2 (100%)

Time: %s, Memory: %s

OK (2 tests, 2 assertions)
23 changes: 23 additions & 0 deletions tests/_files/DataProviderPair/FirstTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Foo;

use PHPUnit\Framework\TestCase;

class FirstTest extends TestCase
{
/**
* @dataProvider provide
*/
public function testFirst($x)
{
$this->assertTrue(true);
}

public function provide()
{
SecondTest::DUMMY;

return [[true]];
}
}
15 changes: 15 additions & 0 deletions tests/_files/DataProviderPair/SecondTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Foo;

use PHPUnit\Framework\TestCase;

class SecondTest extends TestCase
{
const DUMMY = 'dummy';

public function testSecond()
{
$this->assertTrue(true);
}
}

0 comments on commit 7e8e262

Please sign in to comment.