Tagessieger Auswertung
This commit is contained in:
parent
bc5ec5edce
commit
0512bde392
6032 changed files with 674969 additions and 33 deletions
263
pfosten/vendor/phpunit/phpunit/tests/Extensions/PhptTestCaseTest.php
vendored
Normal file
263
pfosten/vendor/phpunit/phpunit/tests/Extensions/PhptTestCaseTest.php
vendored
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Extensions_PhptTestCaseTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
const EXPECT_CONTENT = <<<EOF
|
||||
--TEST--
|
||||
EXPECT test
|
||||
--FILE--
|
||||
<?php echo "Hello PHPUnit!"; ?>
|
||||
--EXPECT--
|
||||
Hello PHPUnit!
|
||||
EOF;
|
||||
|
||||
const EXPECTF_CONTENT = <<<EOF
|
||||
--TEST--
|
||||
EXPECTF test
|
||||
--FILE--
|
||||
<?php echo "Hello PHPUnit!"; ?>
|
||||
--EXPECTF--
|
||||
Hello %s!
|
||||
EOF;
|
||||
|
||||
const EXPECTREGEX_CONTENT = <<<EOF
|
||||
--TEST--
|
||||
EXPECTREGEX test
|
||||
--FILE--
|
||||
<?php echo "Hello PHPUnit!"; ?>
|
||||
--EXPECTREGEX--
|
||||
Hello [HPU]{4}[nit]{3}!
|
||||
EOF;
|
||||
|
||||
const FILE_SECTION = <<<EOF
|
||||
<?php echo "Hello PHPUnit!"; ?>
|
||||
|
||||
EOF;
|
||||
|
||||
protected $filename;
|
||||
protected $testCase;
|
||||
protected $phpUtil;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->filename = sys_get_temp_dir() . '/phpunit.phpt';
|
||||
touch($this->filename);
|
||||
|
||||
$this->phpUtil = $this->getMockForAbstractClass('PHPUnit_Util_PHP', [], '', false);
|
||||
|
||||
$this->testCase = new PHPUnit_Extensions_PhptTestCase($this->filename, $this->phpUtil);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
@unlink($this->filename);
|
||||
|
||||
$this->filename = null;
|
||||
$this->testCase = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the content of the current PHPT test.
|
||||
*
|
||||
* @param string $content
|
||||
*/
|
||||
private function setPhpContent($content)
|
||||
{
|
||||
file_put_contents($this->filename, $content);
|
||||
}
|
||||
|
||||
public function testShouldRunFileSectionAsTest()
|
||||
{
|
||||
$this->setPhpContent(self::EXPECT_CONTENT);
|
||||
|
||||
$fileSection = '<?php echo "Hello PHPUnit!"; ?>' . PHP_EOL;
|
||||
|
||||
$this->phpUtil
|
||||
->expects($this->once())
|
||||
->method('runJob')
|
||||
->with($fileSection)
|
||||
->will($this->returnValue(['stdout' => '', 'stderr' => '']));
|
||||
|
||||
$this->testCase->run();
|
||||
}
|
||||
|
||||
public function testShouldRunSkipifSectionWhenExists()
|
||||
{
|
||||
$skipifSection = '<?php /** Nothing **/ ?>' . PHP_EOL;
|
||||
|
||||
$phptContent = self::EXPECT_CONTENT . PHP_EOL;
|
||||
$phptContent .= '--SKIPIF--' . PHP_EOL;
|
||||
$phptContent .= $skipifSection;
|
||||
|
||||
$this->setPhpContent($phptContent);
|
||||
|
||||
$this->phpUtil
|
||||
->expects($this->at(0))
|
||||
->method('runJob')
|
||||
->with($skipifSection)
|
||||
->will($this->returnValue(['stdout' => '', 'stderr' => '']));
|
||||
|
||||
$this->testCase->run();
|
||||
}
|
||||
|
||||
public function testShouldNotRunTestSectionIfSkipifSectionReturnsOutputWithSkipWord()
|
||||
{
|
||||
$skipifSection = '<?php echo "skip: Reason"; ?>' . PHP_EOL;
|
||||
|
||||
$phptContent = self::EXPECT_CONTENT . PHP_EOL;
|
||||
$phptContent .= '--SKIPIF--' . PHP_EOL;
|
||||
$phptContent .= $skipifSection;
|
||||
|
||||
$this->setPhpContent($phptContent);
|
||||
|
||||
$this->phpUtil
|
||||
->expects($this->once())
|
||||
->method('runJob')
|
||||
->with($skipifSection)
|
||||
->will($this->returnValue(['stdout' => 'skip: Reason', 'stderr' => '']));
|
||||
|
||||
$this->testCase->run();
|
||||
}
|
||||
|
||||
public function testShouldRunCleanSectionWhenDefined()
|
||||
{
|
||||
$cleanSection = '<?php unlink("/tmp/something"); ?>' . PHP_EOL;
|
||||
|
||||
$phptContent = self::EXPECT_CONTENT . PHP_EOL;
|
||||
$phptContent .= '--CLEAN--' . PHP_EOL;
|
||||
$phptContent .= $cleanSection;
|
||||
|
||||
$this->setPhpContent($phptContent);
|
||||
|
||||
$this->phpUtil
|
||||
->expects($this->at(1))
|
||||
->method('runJob')
|
||||
->with($cleanSection);
|
||||
|
||||
$this->testCase->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
* @expectedExceptionMessage Invalid PHPT file
|
||||
*/
|
||||
public function testShouldThrowsAnExceptionWhenPhptFileIsEmpty()
|
||||
{
|
||||
$this->setPhpContent('');
|
||||
|
||||
$this->testCase->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
* @expectedExceptionMessage Invalid PHPT file
|
||||
*/
|
||||
public function testShouldThrowsAnExceptionWhenFileSectionIsMissing()
|
||||
{
|
||||
$this->setPhpContent(
|
||||
<<<EOF
|
||||
--TEST--
|
||||
Something to decribe it
|
||||
--EXPECT--
|
||||
Something
|
||||
EOF
|
||||
);
|
||||
$this->testCase->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
* @expectedExceptionMessage Invalid PHPT file
|
||||
*/
|
||||
public function testShouldThrowsAnExceptionWhenThereIsNoExpecOrExpectifOrExpecregexSectionInPhptFile()
|
||||
{
|
||||
$this->setPhpContent(
|
||||
<<<EOF
|
||||
--TEST--
|
||||
Something to decribe it
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Hello world!\n";
|
||||
?>
|
||||
EOF
|
||||
);
|
||||
$this->testCase->run();
|
||||
}
|
||||
|
||||
public function testShouldValidateExpectSession()
|
||||
{
|
||||
$this->setPhpContent(self::EXPECT_CONTENT);
|
||||
|
||||
$this->phpUtil
|
||||
->expects($this->once())
|
||||
->method('runJob')
|
||||
->with(self::FILE_SECTION)
|
||||
->will($this->returnValue(['stdout' => 'Hello PHPUnit!', 'stderr' => '']));
|
||||
|
||||
$result = $this->testCase->run();
|
||||
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testShouldValidateExpectfSession()
|
||||
{
|
||||
$this->setPhpContent(self::EXPECTF_CONTENT);
|
||||
|
||||
$this->phpUtil
|
||||
->expects($this->once())
|
||||
->method('runJob')
|
||||
->with(self::FILE_SECTION)
|
||||
->will($this->returnValue(['stdout' => 'Hello PHPUnit!', 'stderr' => '']));
|
||||
|
||||
$result = $this->testCase->run();
|
||||
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testShouldValidateExpectregexSession()
|
||||
{
|
||||
$this->setPhpContent(self::EXPECTREGEX_CONTENT);
|
||||
|
||||
$this->phpUtil
|
||||
->expects($this->once())
|
||||
->method('runJob')
|
||||
->with(self::FILE_SECTION)
|
||||
->will($this->returnValue(['stdout' => 'Hello PHPUnit!', 'stderr' => '']));
|
||||
|
||||
$result = $this->testCase->run();
|
||||
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testParseIniSection()
|
||||
{
|
||||
$phptTestCase = new PhpTestCaseProxy(__FILE__);
|
||||
$settings = $phptTestCase->parseIniSection("foo=1\nbar = 2\rbaz = 3\r\nempty=\nignore");
|
||||
|
||||
$expected = [
|
||||
'foo=1',
|
||||
'bar = 2',
|
||||
'baz = 3',
|
||||
'empty=',
|
||||
'ignore',
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $settings);
|
||||
}
|
||||
}
|
||||
|
||||
class PhpTestCaseProxy extends PHPUnit_Extensions_PhptTestCase
|
||||
{
|
||||
public function parseIniSection($content)
|
||||
{
|
||||
return parent::parseIniSection($content);
|
||||
}
|
||||
}
|
||||
60
pfosten/vendor/phpunit/phpunit/tests/Extensions/RepeatedTestTest.php
vendored
Normal file
60
pfosten/vendor/phpunit/phpunit/tests/Extensions/RepeatedTestTest.php
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Extensions_RepeatedTestTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $suite;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->suite = new PHPUnit_Framework_TestSuite;
|
||||
|
||||
$this->suite->addTest(new Success);
|
||||
$this->suite->addTest(new Success);
|
||||
}
|
||||
|
||||
public function testRepeatedOnce()
|
||||
{
|
||||
$test = new PHPUnit_Extensions_RepeatedTest($this->suite, 1);
|
||||
$this->assertCount(2, $test);
|
||||
|
||||
$result = $test->run();
|
||||
$this->assertCount(2, $result);
|
||||
}
|
||||
|
||||
public function testRepeatedMoreThanOnce()
|
||||
{
|
||||
$test = new PHPUnit_Extensions_RepeatedTest($this->suite, 3);
|
||||
$this->assertCount(6, $test);
|
||||
|
||||
$result = $test->run();
|
||||
$this->assertCount(6, $result);
|
||||
}
|
||||
|
||||
public function testRepeatedZero()
|
||||
{
|
||||
$test = new PHPUnit_Extensions_RepeatedTest($this->suite, 0);
|
||||
$this->assertCount(0, $test);
|
||||
|
||||
$result = $test->run();
|
||||
$this->assertCount(0, $result);
|
||||
}
|
||||
|
||||
public function testRepeatedNegative()
|
||||
{
|
||||
try {
|
||||
$test = new PHPUnit_Extensions_RepeatedTest($this->suite, -1);
|
||||
} catch (Exception $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail('Should throw an Exception');
|
||||
}
|
||||
}
|
||||
5
pfosten/vendor/phpunit/phpunit/tests/Fail/fail.phpt
vendored
Normal file
5
pfosten/vendor/phpunit/phpunit/tests/Fail/fail.phpt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
--TEST--
|
||||
// This test intentionally fails and it is checked by Travis.
|
||||
--FILE--
|
||||
--EXPECTF--
|
||||
unexpected
|
||||
3768
pfosten/vendor/phpunit/phpunit/tests/Framework/AssertTest.php
vendored
Normal file
3768
pfosten/vendor/phpunit/phpunit/tests/Framework/AssertTest.php
vendored
Normal file
File diff suppressed because it is too large
Load diff
28
pfosten/vendor/phpunit/phpunit/tests/Framework/BaseTestListenerTest.php
vendored
Normal file
28
pfosten/vendor/phpunit/phpunit/tests/Framework/BaseTestListenerTest.php
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Framework_BaseTestListenerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PHPUnit_Framework_TestResult
|
||||
*/
|
||||
private $result;
|
||||
|
||||
public function testEndEventsAreCounted()
|
||||
{
|
||||
$this->result = new PHPUnit_Framework_TestResult;
|
||||
$listener = new BaseTestListenerSample();
|
||||
$this->result->addListener($listener);
|
||||
$test = new Success;
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertEquals(1, $listener->endCount);
|
||||
}
|
||||
}
|
||||
65
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/ArraySubsetTest.php
vendored
Normal file
65
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/ArraySubsetTest.php
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class PHPUnit_Framework_Constraint_ArraySubsetTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param bool $expected
|
||||
* @param array|Traversable $subset
|
||||
* @param array|Traversable $other
|
||||
* @param bool $strict
|
||||
* @dataProvider evaluateDataProvider
|
||||
*/
|
||||
public function testEvaluate($expected, $subset, $other, $strict)
|
||||
{
|
||||
$constraint = new PHPUnit_Framework_Constraint_ArraySubset($subset, $strict);
|
||||
|
||||
$this->assertSame($expected, $constraint->evaluate($other, '', true));
|
||||
}
|
||||
|
||||
public static function evaluateDataProvider()
|
||||
{
|
||||
return [
|
||||
'loose array subset and array other' => [
|
||||
'expected' => true,
|
||||
'subset' => ['bar' => 0],
|
||||
'other' => ['foo' => '', 'bar' => '0'],
|
||||
'strict' => false
|
||||
],
|
||||
'strict array subset and array other' => [
|
||||
'expected' => false,
|
||||
'subset' => ['bar' => 0],
|
||||
'other' => ['foo' => '', 'bar' => '0'],
|
||||
'strict' => true
|
||||
],
|
||||
'loose array subset and ArrayObject other' => [
|
||||
'expected' => true,
|
||||
'subset' => ['bar' => 0],
|
||||
'other' => new ArrayObject(['foo' => '', 'bar' => '0']),
|
||||
'strict' => false
|
||||
],
|
||||
'strict ArrayObject subset and array other' => [
|
||||
'expected' => true,
|
||||
'subset' => new ArrayObject(['bar' => 0]),
|
||||
'other' => ['foo' => '', 'bar' => 0],
|
||||
'strict' => true
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function testEvaluateWithArrayAccess()
|
||||
{
|
||||
$arrayAccess = new ArrayAccessible(['foo' => 'bar']);
|
||||
|
||||
$constraint = new PHPUnit_Framework_Constraint_ArraySubset(['foo' => 'bar']);
|
||||
|
||||
$this->assertTrue($constraint->evaluate($arrayAccess, '', true));
|
||||
}
|
||||
}
|
||||
92
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/CountTest.php
vendored
Normal file
92
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/CountTest.php
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class CountTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCount()
|
||||
{
|
||||
$countConstraint = new PHPUnit_Framework_Constraint_Count(3);
|
||||
$this->assertTrue($countConstraint->evaluate([1, 2, 3], '', true));
|
||||
|
||||
$countConstraint = new PHPUnit_Framework_Constraint_Count(0);
|
||||
$this->assertTrue($countConstraint->evaluate([], '', true));
|
||||
|
||||
$countConstraint = new PHPUnit_Framework_Constraint_Count(2);
|
||||
$it = new TestIterator([1, 2]);
|
||||
|
||||
$this->assertTrue($countConstraint->evaluate($it, '', true));
|
||||
}
|
||||
|
||||
public function testCountDoesNotChangeIteratorKey()
|
||||
{
|
||||
$countConstraint = new PHPUnit_Framework_Constraint_Count(2);
|
||||
|
||||
// test with 1st implementation of Iterator
|
||||
$it = new TestIterator([1, 2]);
|
||||
|
||||
$countConstraint->evaluate($it, '', true);
|
||||
$this->assertEquals(1, $it->current());
|
||||
|
||||
$it->next();
|
||||
$countConstraint->evaluate($it, '', true);
|
||||
$this->assertEquals(2, $it->current());
|
||||
|
||||
$it->next();
|
||||
$countConstraint->evaluate($it, '', true);
|
||||
$this->assertFalse($it->valid());
|
||||
|
||||
// test with 2nd implementation of Iterator
|
||||
$it = new TestIterator2([1, 2]);
|
||||
|
||||
$countConstraint = new PHPUnit_Framework_Constraint_Count(2);
|
||||
$countConstraint->evaluate($it, '', true);
|
||||
$this->assertEquals(1, $it->current());
|
||||
|
||||
$it->next();
|
||||
$countConstraint->evaluate($it, '', true);
|
||||
$this->assertEquals(2, $it->current());
|
||||
|
||||
$it->next();
|
||||
$countConstraint->evaluate($it, '', true);
|
||||
$this->assertFalse($it->valid());
|
||||
}
|
||||
|
||||
public function testCountGeneratorsDoNotRewind()
|
||||
{
|
||||
$generatorMaker = new TestGeneratorMaker();
|
||||
|
||||
$countConstraint = new PHPUnit_Framework_Constraint_Count(3);
|
||||
|
||||
$generator = $generatorMaker->create([1, 2, 3]);
|
||||
$this->assertEquals(1, $generator->current());
|
||||
$countConstraint->evaluate($generator, '', true);
|
||||
$this->assertEquals(null, $generator->current());
|
||||
|
||||
$countConstraint = new PHPUnit_Framework_Constraint_Count(2);
|
||||
|
||||
$generator = $generatorMaker->create([1, 2, 3]);
|
||||
$this->assertEquals(1, $generator->current());
|
||||
$generator->next();
|
||||
$this->assertEquals(2, $generator->current());
|
||||
$countConstraint->evaluate($generator, '', true);
|
||||
$this->assertEquals(null, $generator->current());
|
||||
|
||||
$countConstraint = new PHPUnit_Framework_Constraint_Count(1);
|
||||
|
||||
$generator = $generatorMaker->create([1, 2, 3]);
|
||||
$this->assertEquals(1, $generator->current());
|
||||
$generator->next();
|
||||
$this->assertEquals(2, $generator->current());
|
||||
$generator->next();
|
||||
$this->assertEquals(3, $generator->current());
|
||||
$countConstraint->evaluate($generator, '', true);
|
||||
$this->assertEquals(null, $generator->current());
|
||||
}
|
||||
}
|
||||
51
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/ExceptionMessageRegExpTest.php
vendored
Normal file
51
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/ExceptionMessageRegExpTest.php
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class ExceptionMessageRegExpTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessageRegExp /^A polymorphic \w+ message/
|
||||
*/
|
||||
public function testRegexMessage()
|
||||
{
|
||||
throw new Exception('A polymorphic exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessageRegExp /^a poly[a-z]+ [a-zA-Z0-9_]+ me(s){2}age$/i
|
||||
*/
|
||||
public function testRegexMessageExtreme()
|
||||
{
|
||||
throw new Exception('A polymorphic exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @requires extension xdebug
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessageRegExp #Screaming preg_match#
|
||||
*/
|
||||
public function testMessageXdebugScreamCompatibility()
|
||||
{
|
||||
ini_set('xdebug.scream', '1');
|
||||
throw new Exception('Screaming preg_match');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception variadic
|
||||
* @expectedExceptionMessageRegExp /^A variadic \w+ message/
|
||||
*/
|
||||
public function testSimultaneousLiteralAndRegExpExceptionMessage()
|
||||
{
|
||||
throw new Exception('A variadic exception message');
|
||||
}
|
||||
}
|
||||
48
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/ExceptionMessageTest.php
vendored
Normal file
48
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/ExceptionMessageTest.php
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class ExceptionMessageTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage A literal exception message
|
||||
*/
|
||||
public function testLiteralMessage()
|
||||
{
|
||||
throw new Exception('A literal exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage A partial
|
||||
*/
|
||||
public function testPartialMessageBegin()
|
||||
{
|
||||
throw new Exception('A partial exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage partial exception
|
||||
*/
|
||||
public function testPartialMessageMiddle()
|
||||
{
|
||||
throw new Exception('A partial exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage exception message
|
||||
*/
|
||||
public function testPartialMessageEnd()
|
||||
{
|
||||
throw new Exception('A partial exception message');
|
||||
}
|
||||
}
|
||||
29
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/IsJsonTest.php
vendored
Normal file
29
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/IsJsonTest.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Framework_Constraint_IsJsonTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider evaluateDataprovider
|
||||
*/
|
||||
public function testEvaluate($expected, $jsonOther)
|
||||
{
|
||||
$constraint = new PHPUnit_Framework_Constraint_IsJson();
|
||||
$this->assertEquals($expected, $constraint->evaluate($jsonOther, '', true));
|
||||
}
|
||||
|
||||
public static function evaluateDataprovider()
|
||||
{
|
||||
return [
|
||||
'valid JSON' => [true, '{}'],
|
||||
'empty string should be treated as invalid JSON' => [false, ''],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Framework_Constraint_JsonMatches_ErrorMessageProviderTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider translateTypeToPrefixDataprovider
|
||||
*/
|
||||
public function testTranslateTypeToPrefix($expected, $type)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::translateTypeToPrefix($type)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider determineJsonErrorDataprovider
|
||||
*/
|
||||
public function testDetermineJsonError($expected, $error, $prefix)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::determineJsonError(
|
||||
$error,
|
||||
$prefix
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function determineJsonErrorDataprovider()
|
||||
{
|
||||
return [
|
||||
'JSON_ERROR_NONE' => [
|
||||
null, 'json_error_none', ''
|
||||
],
|
||||
'JSON_ERROR_DEPTH' => [
|
||||
'Maximum stack depth exceeded', JSON_ERROR_DEPTH, ''
|
||||
],
|
||||
'prefixed JSON_ERROR_DEPTH' => [
|
||||
'TUX: Maximum stack depth exceeded', JSON_ERROR_DEPTH, 'TUX: '
|
||||
],
|
||||
'JSON_ERROR_STATE_MISMatch' => [
|
||||
'Underflow or the modes mismatch', JSON_ERROR_STATE_MISMATCH, ''
|
||||
],
|
||||
'JSON_ERROR_CTRL_CHAR' => [
|
||||
'Unexpected control character found', JSON_ERROR_CTRL_CHAR, ''
|
||||
],
|
||||
'JSON_ERROR_SYNTAX' => [
|
||||
'Syntax error, malformed JSON', JSON_ERROR_SYNTAX, ''
|
||||
],
|
||||
'JSON_ERROR_UTF8`' => [
|
||||
'Malformed UTF-8 characters, possibly incorrectly encoded',
|
||||
JSON_ERROR_UTF8,
|
||||
''
|
||||
],
|
||||
'Invalid error indicator' => [
|
||||
'Unknown error', 55, ''
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public static function translateTypeToPrefixDataprovider()
|
||||
{
|
||||
return [
|
||||
'expected' => ['Expected value JSON decode error - ', 'expected'],
|
||||
'actual' => ['Actual value JSON decode error - ', 'actual'],
|
||||
'default' => ['', ''],
|
||||
];
|
||||
}
|
||||
}
|
||||
39
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/JsonMatchesTest.php
vendored
Normal file
39
pfosten/vendor/phpunit/phpunit/tests/Framework/Constraint/JsonMatchesTest.php
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Framework_Constraint_JsonMatchesTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider evaluateDataprovider
|
||||
*/
|
||||
public function testEvaluate($expected, $jsonOther, $jsonValue)
|
||||
{
|
||||
$constraint = new PHPUnit_Framework_Constraint_JsonMatches($jsonValue);
|
||||
$this->assertEquals($expected, $constraint->evaluate($jsonOther, '', true));
|
||||
}
|
||||
|
||||
public function testToString()
|
||||
{
|
||||
$jsonValue = json_encode(['Mascott' => 'Tux']);
|
||||
$constraint = new PHPUnit_Framework_Constraint_JsonMatches($jsonValue);
|
||||
|
||||
$this->assertEquals('matches JSON string "' . $jsonValue . '"', $constraint->toString());
|
||||
}
|
||||
|
||||
public static function evaluateDataprovider()
|
||||
{
|
||||
return [
|
||||
'valid JSON' => [true, json_encode(['Mascott' => 'Tux']), json_encode(['Mascott' => 'Tux'])],
|
||||
'error syntax' => [false, '{"Mascott"::}', json_encode(['Mascott' => 'Tux'])],
|
||||
'error UTF-8' => [false, json_encode('\xB1\x31'), json_encode(['Mascott' => 'Tux'])],
|
||||
'invalid JSON in class instantiation' => [false, json_encode(['Mascott' => 'Tux']), '{"Mascott"::}'],
|
||||
];
|
||||
}
|
||||
}
|
||||
3053
pfosten/vendor/phpunit/phpunit/tests/Framework/ConstraintTest.php
vendored
Normal file
3053
pfosten/vendor/phpunit/phpunit/tests/Framework/ConstraintTest.php
vendored
Normal file
File diff suppressed because it is too large
Load diff
269
pfosten/vendor/phpunit/phpunit/tests/Framework/SuiteTest.php
vendored
Normal file
269
pfosten/vendor/phpunit/phpunit/tests/Framework/SuiteTest.php
vendored
Normal file
|
|
@ -0,0 +1,269 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'BeforeAndAfterTest.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'BeforeClassAndAfterClassTest.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'TestWithTest.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'BeforeClassWithOnlyDataProviderTest.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'DataProviderSkippedTest.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'DataProviderDependencyTest.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'DataProviderIncompleteTest.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'InheritedTestCase.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'NoTestCaseClass.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'NoTestCases.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'NotPublicTestCase.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'NotVoidTestCase.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'OverrideTestCase.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'RequirementsClassBeforeClassHookTest.php';
|
||||
|
||||
class Framework_SuiteTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $result;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->result = new PHPUnit_Framework_TestResult;
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite;
|
||||
|
||||
$suite->addTest(new self('testAddTestSuite'));
|
||||
$suite->addTest(new self('testInheritedTests'));
|
||||
$suite->addTest(new self('testNoTestCases'));
|
||||
$suite->addTest(new self('testNoTestCaseClass'));
|
||||
$suite->addTest(new self('testNotExistingTestCase'));
|
||||
$suite->addTest(new self('testNotPublicTestCase'));
|
||||
$suite->addTest(new self('testNotVoidTestCase'));
|
||||
$suite->addTest(new self('testOneTestCase'));
|
||||
$suite->addTest(new self('testShadowedTests'));
|
||||
$suite->addTest(new self('testBeforeClassAndAfterClassAnnotations'));
|
||||
$suite->addTest(new self('testBeforeClassWithDataProviders'));
|
||||
$suite->addTest(new self('testBeforeAnnotation'));
|
||||
$suite->addTest(new self('testTestWithAnnotation'));
|
||||
$suite->addTest(new self('testSkippedTestDataProvider'));
|
||||
$suite->addTest(new self('testTestDataProviderDependency'));
|
||||
$suite->addTest(new self('testIncompleteTestDataProvider'));
|
||||
$suite->addTest(new self('testRequirementsBeforeClassHook'));
|
||||
$suite->addTest(new self('testDontSkipInheritedClass'));
|
||||
|
||||
return $suite;
|
||||
}
|
||||
|
||||
public function testAddTestSuite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'OneTestCase'
|
||||
);
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertCount(1, $this->result);
|
||||
}
|
||||
|
||||
public function testInheritedTests()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'InheritedTestCase'
|
||||
);
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertTrue($this->result->wasSuccessful());
|
||||
$this->assertCount(2, $this->result);
|
||||
}
|
||||
|
||||
public function testNoTestCases()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'NoTestCases'
|
||||
);
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertTrue(!$this->result->wasSuccessful());
|
||||
$this->assertEquals(0, $this->result->failureCount());
|
||||
$this->assertEquals(1, $this->result->warningCount());
|
||||
$this->assertCount(1, $this->result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
*/
|
||||
public function testNoTestCaseClass()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('NoTestCaseClass');
|
||||
}
|
||||
|
||||
public function testNotExistingTestCase()
|
||||
{
|
||||
$suite = new self('notExistingMethod');
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertEquals(0, $this->result->errorCount());
|
||||
$this->assertEquals(1, $this->result->failureCount());
|
||||
$this->assertCount(1, $this->result);
|
||||
}
|
||||
|
||||
public function testNotPublicTestCase()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'NotPublicTestCase'
|
||||
);
|
||||
|
||||
$this->assertCount(2, $suite);
|
||||
}
|
||||
|
||||
public function testNotVoidTestCase()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'NotVoidTestCase'
|
||||
);
|
||||
|
||||
$this->assertCount(1, $suite);
|
||||
}
|
||||
|
||||
public function testOneTestCase()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'OneTestCase'
|
||||
);
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertEquals(0, $this->result->errorCount());
|
||||
$this->assertEquals(0, $this->result->failureCount());
|
||||
$this->assertCount(1, $this->result);
|
||||
$this->assertTrue($this->result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testShadowedTests()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'OverrideTestCase'
|
||||
);
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertCount(1, $this->result);
|
||||
}
|
||||
|
||||
public function testBeforeClassAndAfterClassAnnotations()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'BeforeClassAndAfterClassTest'
|
||||
);
|
||||
|
||||
BeforeClassAndAfterClassTest::resetProperties();
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertEquals(1, BeforeClassAndAfterClassTest::$beforeClassWasRun, '@beforeClass method was not run once for the whole suite.');
|
||||
$this->assertEquals(1, BeforeClassAndAfterClassTest::$afterClassWasRun, '@afterClass method was not run once for the whole suite.');
|
||||
}
|
||||
|
||||
public function testBeforeClassWithDataProviders()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'BeforeClassWithOnlyDataProviderTest'
|
||||
);
|
||||
|
||||
BeforeClassWithOnlyDataProviderTest::resetProperties();
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertTrue(BeforeClassWithOnlyDataProviderTest::$setUpBeforeClassWasCalled, 'setUpBeforeClass method was not run.');
|
||||
$this->assertTrue(BeforeClassWithOnlyDataProviderTest::$beforeClassWasCalled, '@beforeClass method was not run.');
|
||||
}
|
||||
|
||||
public function testBeforeAnnotation()
|
||||
{
|
||||
$test = new PHPUnit_Framework_TestSuite(
|
||||
'BeforeAndAfterTest'
|
||||
);
|
||||
|
||||
BeforeAndAfterTest::resetProperties();
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(2, BeforeAndAfterTest::$beforeWasRun);
|
||||
$this->assertEquals(2, BeforeAndAfterTest::$afterWasRun);
|
||||
}
|
||||
|
||||
public function testTestWithAnnotation()
|
||||
{
|
||||
$test = new PHPUnit_Framework_TestSuite(
|
||||
'TestWithTest'
|
||||
);
|
||||
|
||||
BeforeAndAfterTest::resetProperties();
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(4, $result->passed());
|
||||
}
|
||||
|
||||
public function testSkippedTestDataProvider()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('DataProviderSkippedTest');
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertEquals(3, $this->result->count());
|
||||
$this->assertEquals(1, $this->result->skippedCount());
|
||||
}
|
||||
|
||||
public function testTestDataProviderDependency()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('DataProviderDependencyTest');
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$skipped = $this->result->skipped();
|
||||
$lastSkippedResult = array_pop($skipped);
|
||||
$message = $lastSkippedResult->thrownException()->getMessage();
|
||||
|
||||
$this->assertContains('Test for DataProviderDependencyTest::testDependency skipped by data provider', $message);
|
||||
}
|
||||
|
||||
public function testIncompleteTestDataProvider()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('DataProviderIncompleteTest');
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertEquals(3, $this->result->count());
|
||||
$this->assertEquals(1, $this->result->notImplementedCount());
|
||||
}
|
||||
|
||||
public function testRequirementsBeforeClassHook()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'RequirementsClassBeforeClassHookTest'
|
||||
);
|
||||
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertEquals(0, $this->result->errorCount());
|
||||
$this->assertEquals(1, $this->result->skippedCount());
|
||||
}
|
||||
|
||||
public function testDontSkipInheritedClass()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite(
|
||||
'DontSkipInheritedClass'
|
||||
);
|
||||
|
||||
$dir = dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Inheritance' . DIRECTORY_SEPARATOR;
|
||||
|
||||
$suite->addTestFile($dir . 'InheritanceA.php');
|
||||
$suite->addTestFile($dir . 'InheritanceB.php');
|
||||
$result = $suite->run();
|
||||
$this->assertCount(2, $result);
|
||||
}
|
||||
}
|
||||
689
pfosten/vendor/phpunit/phpunit/tests/Framework/TestCaseTest.php
vendored
Normal file
689
pfosten/vendor/phpunit/phpunit/tests/Framework/TestCaseTest.php
vendored
Normal file
|
|
@ -0,0 +1,689 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'NoArgTestCaseTest.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Singleton.php';
|
||||
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Mockable.php';
|
||||
|
||||
$GLOBALS['a'] = 'a';
|
||||
$_ENV['b'] = 'b';
|
||||
$_POST['c'] = 'c';
|
||||
$_GET['d'] = 'd';
|
||||
$_COOKIE['e'] = 'e';
|
||||
$_SERVER['f'] = 'f';
|
||||
$_FILES['g'] = 'g';
|
||||
$_REQUEST['h'] = 'h';
|
||||
$GLOBALS['i'] = 'i';
|
||||
|
||||
class Framework_TestCaseTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $backupGlobalsBlacklist = ['i', 'singleton'];
|
||||
|
||||
/**
|
||||
* Used be testStaticAttributesBackupPre
|
||||
*/
|
||||
protected static $testStatic = 0;
|
||||
|
||||
public function testCaseToString()
|
||||
{
|
||||
$this->assertEquals(
|
||||
'Framework_TestCaseTest::testCaseToString',
|
||||
$this->toString()
|
||||
);
|
||||
}
|
||||
|
||||
public function testSuccess()
|
||||
{
|
||||
$test = new Success;
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(PHPUnit_Runner_BaseTestRunner::STATUS_PASSED, $test->getStatus());
|
||||
$this->assertEquals(0, $result->errorCount());
|
||||
$this->assertEquals(0, $result->failureCount());
|
||||
$this->assertEquals(0, $result->skippedCount());
|
||||
$this->assertCount(1, $result);
|
||||
}
|
||||
|
||||
public function testFailure()
|
||||
{
|
||||
$test = new Failure;
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE, $test->getStatus());
|
||||
$this->assertEquals(0, $result->errorCount());
|
||||
$this->assertEquals(1, $result->failureCount());
|
||||
$this->assertEquals(0, $result->skippedCount());
|
||||
$this->assertCount(1, $result);
|
||||
}
|
||||
|
||||
public function testError()
|
||||
{
|
||||
$test = new TestError;
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(PHPUnit_Runner_BaseTestRunner::STATUS_ERROR, $test->getStatus());
|
||||
$this->assertEquals(1, $result->errorCount());
|
||||
$this->assertEquals(0, $result->failureCount());
|
||||
$this->assertEquals(0, $result->skippedCount());
|
||||
$this->assertCount(1, $result);
|
||||
}
|
||||
|
||||
public function testSkipped()
|
||||
{
|
||||
$test = new TestSkipped();
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED, $test->getStatus());
|
||||
$this->assertEquals('Skipped test', $test->getStatusMessage());
|
||||
$this->assertEquals(0, $result->errorCount());
|
||||
$this->assertEquals(0, $result->failureCount());
|
||||
$this->assertEquals(1, $result->skippedCount());
|
||||
$this->assertCount(1, $result);
|
||||
}
|
||||
|
||||
public function testIncomplete()
|
||||
{
|
||||
$test = new TestIncomplete();
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE, $test->getStatus());
|
||||
$this->assertEquals('Incomplete test', $test->getStatusMessage());
|
||||
$this->assertEquals(0, $result->errorCount());
|
||||
$this->assertEquals(0, $result->failureCount());
|
||||
$this->assertEquals(0, $result->skippedCount());
|
||||
$this->assertCount(1, $result);
|
||||
}
|
||||
|
||||
public function testExceptionInSetUp()
|
||||
{
|
||||
$test = new ExceptionInSetUpTest('testSomething');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertTrue($test->setUp);
|
||||
$this->assertFalse($test->assertPreConditions);
|
||||
$this->assertFalse($test->testSomething);
|
||||
$this->assertFalse($test->assertPostConditions);
|
||||
$this->assertTrue($test->tearDown);
|
||||
}
|
||||
|
||||
public function testExceptionInAssertPreConditions()
|
||||
{
|
||||
$test = new ExceptionInAssertPreConditionsTest('testSomething');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertTrue($test->setUp);
|
||||
$this->assertTrue($test->assertPreConditions);
|
||||
$this->assertFalse($test->testSomething);
|
||||
$this->assertFalse($test->assertPostConditions);
|
||||
$this->assertTrue($test->tearDown);
|
||||
}
|
||||
|
||||
public function testExceptionInTest()
|
||||
{
|
||||
$test = new ExceptionInTest('testSomething');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertTrue($test->setUp);
|
||||
$this->assertTrue($test->assertPreConditions);
|
||||
$this->assertTrue($test->testSomething);
|
||||
$this->assertFalse($test->assertPostConditions);
|
||||
$this->assertTrue($test->tearDown);
|
||||
}
|
||||
|
||||
public function testExceptionInAssertPostConditions()
|
||||
{
|
||||
$test = new ExceptionInAssertPostConditionsTest('testSomething');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertTrue($test->setUp);
|
||||
$this->assertTrue($test->assertPreConditions);
|
||||
$this->assertTrue($test->testSomething);
|
||||
$this->assertTrue($test->assertPostConditions);
|
||||
$this->assertTrue($test->tearDown);
|
||||
}
|
||||
|
||||
public function testExceptionInTearDown()
|
||||
{
|
||||
$test = new ExceptionInTearDownTest('testSomething');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertTrue($test->setUp);
|
||||
$this->assertTrue($test->assertPreConditions);
|
||||
$this->assertTrue($test->testSomething);
|
||||
$this->assertTrue($test->assertPostConditions);
|
||||
$this->assertTrue($test->tearDown);
|
||||
}
|
||||
|
||||
public function testNoArgTestCasePasses()
|
||||
{
|
||||
$result = new PHPUnit_Framework_TestResult;
|
||||
$t = new PHPUnit_Framework_TestSuite('NoArgTestCaseTest');
|
||||
|
||||
$t->run($result);
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertEquals(0, $result->failureCount());
|
||||
$this->assertEquals(0, $result->errorCount());
|
||||
}
|
||||
|
||||
public function testWasRun()
|
||||
{
|
||||
$test = new WasRun;
|
||||
$test->run();
|
||||
|
||||
$this->assertTrue($test->wasRun);
|
||||
}
|
||||
|
||||
public function testException()
|
||||
{
|
||||
$test = new ThrowExceptionTestCase('test');
|
||||
$test->expectException(RuntimeException::class);
|
||||
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testExceptionWithEmptyMessage()
|
||||
{
|
||||
$test = new ThrowExceptionTestCase('test');
|
||||
$test->expectException(RuntimeException::class, '');
|
||||
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testExceptionWithNullMessage()
|
||||
{
|
||||
$test = new ThrowExceptionTestCase('test');
|
||||
$test->expectException(RuntimeException::class, null);
|
||||
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testExceptionWithMessage()
|
||||
{
|
||||
$test = new ThrowExceptionTestCase('test');
|
||||
$test->expectException(RuntimeException::class);
|
||||
$test->expectExceptionMessage('A runtime error occurred');
|
||||
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testExceptionWithWrongMessage()
|
||||
{
|
||||
$test = new ThrowExceptionTestCase('test');
|
||||
$test->expectException(RuntimeException::class);
|
||||
$test->expectExceptionMessage('A logic error occurred');
|
||||
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(1, $result->failureCount());
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertEquals(
|
||||
"Failed asserting that exception message 'A runtime error occurred' contains 'A logic error occurred'.",
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testExceptionWithRegexpMessage()
|
||||
{
|
||||
$test = new ThrowExceptionTestCase('test');
|
||||
$test->expectException(RuntimeException::class);
|
||||
$test->expectExceptionMessageRegExp('/runtime .*? occurred/');
|
||||
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testExceptionWithWrongRegexpMessage()
|
||||
{
|
||||
$test = new ThrowExceptionTestCase('test');
|
||||
$test->expectException(RuntimeException::class);
|
||||
$test->expectExceptionMessageRegExp('/logic .*? occurred/');
|
||||
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(1, $result->failureCount());
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertEquals(
|
||||
"Failed asserting that exception message 'A runtime error occurred' matches '/logic .*? occurred/'.",
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testExceptionWithInvalidRegexpMessage()
|
||||
{
|
||||
$test = new ThrowExceptionTestCase('test');
|
||||
$test->expectException(RuntimeException::class);
|
||||
$test->expectExceptionMessageRegExp('#runtime .*? occurred/');
|
||||
|
||||
$test->run();
|
||||
|
||||
$this->assertEquals(
|
||||
"Invalid expected exception message regex given: '#runtime .*? occurred/'",
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testNoException()
|
||||
{
|
||||
$test = new ThrowNoExceptionTestCase('test');
|
||||
$test->expectException(RuntimeException::class);
|
||||
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(1, $result->failureCount());
|
||||
$this->assertCount(1, $result);
|
||||
}
|
||||
|
||||
public function testWrongException()
|
||||
{
|
||||
$test = new ThrowExceptionTestCase('test');
|
||||
$test->expectException(InvalidArgumentException::class);
|
||||
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(1, $result->failureCount());
|
||||
$this->assertCount(1, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
public function testGlobalsBackupPre()
|
||||
{
|
||||
global $a;
|
||||
global $i;
|
||||
|
||||
$this->assertEquals('a', $a);
|
||||
$this->assertEquals('a', $GLOBALS['a']);
|
||||
$this->assertEquals('b', $_ENV['b']);
|
||||
$this->assertEquals('c', $_POST['c']);
|
||||
$this->assertEquals('d', $_GET['d']);
|
||||
$this->assertEquals('e', $_COOKIE['e']);
|
||||
$this->assertEquals('f', $_SERVER['f']);
|
||||
$this->assertEquals('g', $_FILES['g']);
|
||||
$this->assertEquals('h', $_REQUEST['h']);
|
||||
$this->assertEquals('i', $i);
|
||||
$this->assertEquals('i', $GLOBALS['i']);
|
||||
|
||||
$GLOBALS['a'] = 'aa';
|
||||
$GLOBALS['foo'] = 'bar';
|
||||
$_ENV['b'] = 'bb';
|
||||
$_POST['c'] = 'cc';
|
||||
$_GET['d'] = 'dd';
|
||||
$_COOKIE['e'] = 'ee';
|
||||
$_SERVER['f'] = 'ff';
|
||||
$_FILES['g'] = 'gg';
|
||||
$_REQUEST['h'] = 'hh';
|
||||
$GLOBALS['i'] = 'ii';
|
||||
|
||||
$this->assertEquals('aa', $a);
|
||||
$this->assertEquals('aa', $GLOBALS['a']);
|
||||
$this->assertEquals('bar', $GLOBALS['foo']);
|
||||
$this->assertEquals('bb', $_ENV['b']);
|
||||
$this->assertEquals('cc', $_POST['c']);
|
||||
$this->assertEquals('dd', $_GET['d']);
|
||||
$this->assertEquals('ee', $_COOKIE['e']);
|
||||
$this->assertEquals('ff', $_SERVER['f']);
|
||||
$this->assertEquals('gg', $_FILES['g']);
|
||||
$this->assertEquals('hh', $_REQUEST['h']);
|
||||
$this->assertEquals('ii', $i);
|
||||
$this->assertEquals('ii', $GLOBALS['i']);
|
||||
}
|
||||
|
||||
public function testGlobalsBackupPost()
|
||||
{
|
||||
global $a;
|
||||
global $i;
|
||||
|
||||
$this->assertEquals('a', $a);
|
||||
$this->assertEquals('a', $GLOBALS['a']);
|
||||
$this->assertEquals('b', $_ENV['b']);
|
||||
$this->assertEquals('c', $_POST['c']);
|
||||
$this->assertEquals('d', $_GET['d']);
|
||||
$this->assertEquals('e', $_COOKIE['e']);
|
||||
$this->assertEquals('f', $_SERVER['f']);
|
||||
$this->assertEquals('g', $_FILES['g']);
|
||||
$this->assertEquals('h', $_REQUEST['h']);
|
||||
$this->assertEquals('ii', $i);
|
||||
$this->assertEquals('ii', $GLOBALS['i']);
|
||||
|
||||
$this->assertArrayNotHasKey('foo', $GLOBALS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @backupGlobals enabled
|
||||
* @backupStaticAttributes enabled
|
||||
*/
|
||||
public function testStaticAttributesBackupPre()
|
||||
{
|
||||
$GLOBALS['singleton'] = Singleton::getInstance();
|
||||
self::$testStatic = 123;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testStaticAttributesBackupPre
|
||||
*/
|
||||
public function testStaticAttributesBackupPost()
|
||||
{
|
||||
$this->assertNotSame($GLOBALS['singleton'], Singleton::getInstance());
|
||||
$this->assertSame(0, self::$testStatic);
|
||||
}
|
||||
|
||||
public function testIsInIsolationReturnsFalse()
|
||||
{
|
||||
$test = new IsolationTest('testIsInIsolationReturnsFalse');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testIsInIsolationReturnsTrue()
|
||||
{
|
||||
$test = new IsolationTest('testIsInIsolationReturnsTrue');
|
||||
$test->setRunTestInSeparateProcess(true);
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testExpectOutputStringFooActualFoo()
|
||||
{
|
||||
$test = new OutputTestCase('testExpectOutputStringFooActualFoo');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testExpectOutputStringFooActualBar()
|
||||
{
|
||||
$test = new OutputTestCase('testExpectOutputStringFooActualBar');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertFalse($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testExpectOutputRegexFooActualFoo()
|
||||
{
|
||||
$test = new OutputTestCase('testExpectOutputRegexFooActualFoo');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertTrue($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testExpectOutputRegexFooActualBar()
|
||||
{
|
||||
$test = new OutputTestCase('testExpectOutputRegexFooActualBar');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertFalse($result->wasSuccessful());
|
||||
}
|
||||
|
||||
public function testSkipsIfRequiresHigherVersionOfPHPUnit()
|
||||
{
|
||||
$test = new RequirementsTest('testAlwaysSkip');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(1, $result->skippedCount());
|
||||
$this->assertEquals(
|
||||
'PHPUnit >= 1111111 is required.',
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testSkipsIfRequiresHigherVersionOfPHP()
|
||||
{
|
||||
$test = new RequirementsTest('testAlwaysSkip2');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(1, $result->skippedCount());
|
||||
$this->assertEquals(
|
||||
'PHP >= 9999999 is required.',
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testSkipsIfRequiresNonExistingOs()
|
||||
{
|
||||
$test = new RequirementsTest('testAlwaysSkip3');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(1, $result->skippedCount());
|
||||
$this->assertEquals(
|
||||
'Operating system matching /DOESNOTEXIST/i is required.',
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testSkipsIfRequiresNonExistingFunction()
|
||||
{
|
||||
$test = new RequirementsTest('testNine');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(1, $result->skippedCount());
|
||||
$this->assertEquals(
|
||||
'Function testFunc is required.',
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testSkipsIfRequiresNonExistingExtension()
|
||||
{
|
||||
$test = new RequirementsTest('testTen');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(
|
||||
'Extension testExt is required.',
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testSkipsIfRequiresExtensionWithAMinimumVersion()
|
||||
{
|
||||
$test = new RequirementsTest('testSpecificExtensionVersion');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(
|
||||
'Extension testExt >= 1.8.0 is required.',
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testSkipsProvidesMessagesForAllSkippingReasons()
|
||||
{
|
||||
$test = new RequirementsTest('testAllPossibleRequirements');
|
||||
$result = $test->run();
|
||||
|
||||
$this->assertEquals(
|
||||
'PHP >= 99-dev is required.' . PHP_EOL .
|
||||
'PHPUnit >= 9-dev is required.' . PHP_EOL .
|
||||
'Operating system matching /DOESNOTEXIST/i is required.' . PHP_EOL .
|
||||
'Function testFuncOne is required.' . PHP_EOL .
|
||||
'Function testFuncTwo is required.' . PHP_EOL .
|
||||
'Extension testExtOne is required.' . PHP_EOL .
|
||||
'Extension testExtTwo is required.' . PHP_EOL .
|
||||
'Extension testExtThree >= 2.0 is required.',
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testRequiringAnExistingMethodDoesNotSkip()
|
||||
{
|
||||
$test = new RequirementsTest('testExistingMethod');
|
||||
$result = $test->run();
|
||||
$this->assertEquals(0, $result->skippedCount());
|
||||
}
|
||||
|
||||
public function testRequiringAnExistingFunctionDoesNotSkip()
|
||||
{
|
||||
$test = new RequirementsTest('testExistingFunction');
|
||||
$result = $test->run();
|
||||
$this->assertEquals(0, $result->skippedCount());
|
||||
}
|
||||
|
||||
public function testRequiringAnExistingExtensionDoesNotSkip()
|
||||
{
|
||||
$test = new RequirementsTest('testExistingExtension');
|
||||
$result = $test->run();
|
||||
$this->assertEquals(0, $result->skippedCount());
|
||||
}
|
||||
|
||||
public function testRequiringAnExistingOsDoesNotSkip()
|
||||
{
|
||||
$test = new RequirementsTest('testExistingOs');
|
||||
$result = $test->run();
|
||||
$this->assertEquals(0, $result->skippedCount());
|
||||
}
|
||||
|
||||
public function testCurrentWorkingDirectoryIsRestored()
|
||||
{
|
||||
$expectedCwd = getcwd();
|
||||
|
||||
$test = new ChangeCurrentWorkingDirectoryTest('testSomethingThatChangesTheCwd');
|
||||
$test->run();
|
||||
|
||||
$this->assertSame($expectedCwd, getcwd());
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 7
|
||||
* @expectedException TypeError
|
||||
*/
|
||||
public function testTypeErrorCanBeExpected()
|
||||
{
|
||||
$o = new ClassWithScalarTypeDeclarations;
|
||||
$o->foo(null, null);
|
||||
}
|
||||
|
||||
public function testCreateMockFromClassName()
|
||||
{
|
||||
$mock = $this->createMock(Mockable::class);
|
||||
|
||||
$this->assertInstanceOf(Mockable::class, $mock);
|
||||
$this->assertInstanceOf(PHPUnit_Framework_MockObject_MockObject::class, $mock);
|
||||
}
|
||||
|
||||
public function testCreateMockMocksAllMethods()
|
||||
{
|
||||
/** @var Mockable $mock */
|
||||
$mock = $this->createMock(Mockable::class);
|
||||
|
||||
$this->assertNull($mock->foo());
|
||||
$this->assertNull($mock->bar());
|
||||
}
|
||||
|
||||
public function testCreatePartialMockDoesNotMockAllMethods()
|
||||
{
|
||||
/** @var Mockable $mock */
|
||||
$mock = $this->createPartialMock(Mockable::class, ['foo']);
|
||||
|
||||
$this->assertNull($mock->foo());
|
||||
$this->assertTrue($mock->bar());
|
||||
}
|
||||
|
||||
public function testCreatePartialMockCanMockNoMethods()
|
||||
{
|
||||
/** @var Mockable $mock */
|
||||
$mock = $this->createPartialMock(Mockable::class, []);
|
||||
|
||||
$this->assertTrue($mock->foo());
|
||||
$this->assertTrue($mock->bar());
|
||||
}
|
||||
|
||||
public function testCreateMockSkipsConstructor()
|
||||
{
|
||||
/** @var Mockable $mock */
|
||||
$mock = $this->createMock(Mockable::class);
|
||||
|
||||
$this->assertFalse($mock->constructorCalled);
|
||||
}
|
||||
|
||||
public function testCreateMockDisablesOriginalClone()
|
||||
{
|
||||
/** @var Mockable $mock */
|
||||
$mock = $this->createMock(Mockable::class);
|
||||
|
||||
$cloned = clone $mock;
|
||||
$this->assertFalse($cloned->cloned);
|
||||
}
|
||||
|
||||
public function testConfiguredMockCanBeCreated()
|
||||
{
|
||||
/** @var Mockable $mock */
|
||||
$mock = $this->createConfiguredMock(
|
||||
Mockable::class,
|
||||
[
|
||||
'foo' => false
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertFalse($mock->foo());
|
||||
$this->assertNull($mock->bar());
|
||||
}
|
||||
|
||||
public function testProvidingOfAutoreferencedArray()
|
||||
{
|
||||
$test = new \TestAutoreferenced('testJsonEncodeException', $this->getAutoreferencedArray());
|
||||
$test->runBare();
|
||||
|
||||
$this->assertInternalType('array', $test->myTestData);
|
||||
$this->assertArrayHasKey('data', $test->myTestData);
|
||||
$this->assertEquals($test->myTestData['data'][0], $test->myTestData['data']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getAutoreferencedArray()
|
||||
{
|
||||
$recursionData = [];
|
||||
$recursionData[] = &$recursionData;
|
||||
|
||||
return [
|
||||
'RECURSION' => [
|
||||
'data' => $recursionData
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function testProvidingArrayThatMixesObjectsAndScalars()
|
||||
{
|
||||
$data = [
|
||||
[123],
|
||||
['foo'],
|
||||
[$this->createMock(Mockable::class)],
|
||||
];
|
||||
|
||||
$test = new \TestAutoreferenced('testJsonEncodeException', [$data]);
|
||||
$test->runBare();
|
||||
|
||||
$this->assertInternalType('array', $test->myTestData);
|
||||
$this->assertSame($data, $test->myTestData);
|
||||
}
|
||||
}
|
||||
21
pfosten/vendor/phpunit/phpunit/tests/Framework/TestFailureTest.php
vendored
Normal file
21
pfosten/vendor/phpunit/phpunit/tests/Framework/TestFailureTest.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Framework_TestFailureTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testToString()
|
||||
{
|
||||
$test = new self(__FUNCTION__);
|
||||
$exception = new PHPUnit_Framework_Exception('message');
|
||||
$failure = new PHPUnit_Framework_TestFailure($test, $exception);
|
||||
|
||||
$this->assertEquals(__METHOD__ . ': message', $failure->toString());
|
||||
}
|
||||
}
|
||||
24
pfosten/vendor/phpunit/phpunit/tests/Framework/TestImplementorTest.php
vendored
Normal file
24
pfosten/vendor/phpunit/phpunit/tests/Framework/TestImplementorTest.php
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Framework_TestImplementorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testSuccessfulRun()
|
||||
{
|
||||
$result = new PHPUnit_Framework_TestResult;
|
||||
|
||||
$test = new DoubleTestCase(new Success);
|
||||
$test->run($result);
|
||||
|
||||
$this->assertCount(count($test), $result);
|
||||
$this->assertEquals(0, $result->errorCount());
|
||||
$this->assertEquals(0, $result->failureCount());
|
||||
}
|
||||
}
|
||||
110
pfosten/vendor/phpunit/phpunit/tests/Framework/TestListenerTest.php
vendored
Normal file
110
pfosten/vendor/phpunit/phpunit/tests/Framework/TestListenerTest.php
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Framework_TestListenerTest extends PHPUnit_Framework_TestCase implements PHPUnit_Framework_TestListener
|
||||
{
|
||||
protected $endCount;
|
||||
protected $errorCount;
|
||||
protected $failureCount;
|
||||
protected $warningCount;
|
||||
protected $notImplementedCount;
|
||||
protected $riskyCount;
|
||||
protected $skippedCount;
|
||||
protected $result;
|
||||
protected $startCount;
|
||||
|
||||
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
$this->errorCount++;
|
||||
}
|
||||
|
||||
public function addWarning(PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, $time)
|
||||
{
|
||||
$this->warningCount++;
|
||||
}
|
||||
|
||||
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
|
||||
{
|
||||
$this->failureCount++;
|
||||
}
|
||||
|
||||
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
$this->notImplementedCount++;
|
||||
}
|
||||
|
||||
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
$this->riskyCount++;
|
||||
}
|
||||
|
||||
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
|
||||
{
|
||||
$this->skippedCount++;
|
||||
}
|
||||
|
||||
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
|
||||
{
|
||||
}
|
||||
|
||||
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
|
||||
{
|
||||
}
|
||||
|
||||
public function startTest(PHPUnit_Framework_Test $test)
|
||||
{
|
||||
$this->startCount++;
|
||||
}
|
||||
|
||||
public function endTest(PHPUnit_Framework_Test $test, $time)
|
||||
{
|
||||
$this->endCount++;
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->result = new PHPUnit_Framework_TestResult;
|
||||
$this->result->addListener($this);
|
||||
|
||||
$this->endCount = 0;
|
||||
$this->failureCount = 0;
|
||||
$this->notImplementedCount = 0;
|
||||
$this->riskyCount = 0;
|
||||
$this->skippedCount = 0;
|
||||
$this->startCount = 0;
|
||||
}
|
||||
|
||||
public function testError()
|
||||
{
|
||||
$test = new TestError;
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertEquals(1, $this->errorCount);
|
||||
$this->assertEquals(1, $this->endCount);
|
||||
}
|
||||
|
||||
public function testFailure()
|
||||
{
|
||||
$test = new Failure;
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertEquals(1, $this->failureCount);
|
||||
$this->assertEquals(1, $this->endCount);
|
||||
}
|
||||
|
||||
public function testStartStop()
|
||||
{
|
||||
$test = new Success;
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertEquals(1, $this->startCount);
|
||||
$this->assertEquals(1, $this->endCount);
|
||||
}
|
||||
}
|
||||
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1149.phpt
vendored
Normal file
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1149.phpt
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
--TEST--
|
||||
GH-1149: Test swallows output buffer when run in a separate process
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue1149Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/1149/Issue1149Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
.1. 2 / 2 (100%)2
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (2 tests, 2 assertions)
|
||||
18
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1149/Issue1149Test.php
vendored
Normal file
18
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1149/Issue1149Test.php
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
class Issue1149Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testOne()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
print '1';
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
*/
|
||||
public function testTwo()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
print '2';
|
||||
}
|
||||
}
|
||||
25
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1216.phpt
vendored
Normal file
25
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1216.phpt
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
--TEST--
|
||||
GH-1216: PHPUnit bootstrap must take globals vars even when the file is specified in command line
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--configuration';
|
||||
$_SERVER['argv'][2] = __DIR__ . '/1216/phpunit1216.xml';
|
||||
$_SERVER['argv'][3] = '--debug';
|
||||
$_SERVER['argv'][4] = '--bootstrap';
|
||||
$_SERVER['argv'][5] = __DIR__ . '/1216/bootstrap1216.php';
|
||||
$_SERVER['argv'][6] = __DIR__ . '/1216/Issue1216Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
|
||||
Starting test 'Issue1216Test::testConfigAvailableInBootstrap'.
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1216/Issue1216Test.php
vendored
Normal file
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1216/Issue1216Test.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
class Issue1216Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testConfigAvailableInBootstrap()
|
||||
{
|
||||
$this->assertTrue($_ENV['configAvailableInBootstrap']);
|
||||
}
|
||||
}
|
||||
2
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1216/bootstrap1216.php
vendored
Normal file
2
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1216/bootstrap1216.php
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
$_ENV['configAvailableInBootstrap'] = isset($_ENV['loadedFromConfig']);
|
||||
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1216/phpunit1216.xml
vendored
Normal file
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1216/phpunit1216.xml
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<phpunit>
|
||||
<testsuite name="Github issue 1216">
|
||||
<file>Issue1216Test.php</file>
|
||||
</testsuite>
|
||||
<php>
|
||||
<env name="loadedFromConfig" value="1"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1265.phpt
vendored
Normal file
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1265.phpt
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
--TEST--
|
||||
GH-1265: Could not use "PHPUnit_Runner_StandardTestSuiteLoader" as loader
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--configuration';
|
||||
$_SERVER['argv'][2] = __DIR__ . '/1265/phpunit1265.xml';
|
||||
$_SERVER['argv'][3] = 'Issue1265Test';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/1265/Issue1265Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1265/Issue1265Test.php
vendored
Normal file
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1265/Issue1265Test.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
class Issue1265Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testTrue()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
2
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1265/phpunit1265.xml
vendored
Normal file
2
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1265/phpunit1265.xml
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<phpunit testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader">
|
||||
</phpunit>
|
||||
24
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1330.phpt
vendored
Normal file
24
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1330.phpt
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
--TEST--
|
||||
GH-1330: Allow non-ambiguous shortened longopts
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--deb';
|
||||
$_SERVER['argv'][2] = '--config';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/1330/phpunit1330.xml';
|
||||
$_SERVER['argv'][4] = 'Issue1330Test';
|
||||
$_SERVER['argv'][5] = __DIR__ . '/1330/Issue1330Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
|
||||
Starting test 'Issue1330Test::testTrue'.
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1330/Issue1330Test.php
vendored
Normal file
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1330/Issue1330Test.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
class Issue1330Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testTrue()
|
||||
{
|
||||
$this->assertTrue(PHPUNIT_1330);
|
||||
}
|
||||
}
|
||||
5
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1330/phpunit1330.xml
vendored
Normal file
5
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1330/phpunit1330.xml
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<phpunit>
|
||||
<php>
|
||||
<const name="PHPUNIT_1330" value="true"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1335.phpt
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1335.phpt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1335
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--bootstrap';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/1335/bootstrap1335.php';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/1335/Issue1335Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
............ 12 / 12 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (12 tests, 12 assertions)
|
||||
67
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1335/Issue1335Test.php
vendored
Normal file
67
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1335/Issue1335Test.php
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState enabled
|
||||
*/
|
||||
class Issue1335Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGlobalString()
|
||||
{
|
||||
$this->assertEquals('Hello', $GLOBALS['globalString']);
|
||||
}
|
||||
|
||||
public function testGlobalIntTruthy()
|
||||
{
|
||||
$this->assertEquals(1, $GLOBALS['globalIntTruthy']);
|
||||
}
|
||||
|
||||
public function testGlobalIntFalsey()
|
||||
{
|
||||
$this->assertEquals(0, $GLOBALS['globalIntFalsey']);
|
||||
}
|
||||
|
||||
public function testGlobalFloat()
|
||||
{
|
||||
$this->assertEquals(1.123, $GLOBALS['globalFloat']);
|
||||
}
|
||||
|
||||
public function testGlobalBoolTrue()
|
||||
{
|
||||
$this->assertTrue($GLOBALS['globalBoolTrue']);
|
||||
}
|
||||
|
||||
public function testGlobalBoolFalse()
|
||||
{
|
||||
$this->assertFalse($GLOBALS['globalBoolFalse']);
|
||||
}
|
||||
|
||||
public function testGlobalNull()
|
||||
{
|
||||
$this->assertEquals(null, $GLOBALS['globalNull']);
|
||||
}
|
||||
|
||||
public function testGlobalArray()
|
||||
{
|
||||
$this->assertEquals(['foo'], $GLOBALS['globalArray']);
|
||||
}
|
||||
|
||||
public function testGlobalNestedArray()
|
||||
{
|
||||
$this->assertEquals([['foo']], $GLOBALS['globalNestedArray']);
|
||||
}
|
||||
|
||||
public function testGlobalObject()
|
||||
{
|
||||
$this->assertEquals((object) ['foo'=> 'bar'], $GLOBALS['globalObject']);
|
||||
}
|
||||
|
||||
public function testGlobalObjectWithBackSlashString()
|
||||
{
|
||||
$this->assertEquals((object) ['foo'=> 'back\\slash'], $GLOBALS['globalObjectWithBackSlashString']);
|
||||
}
|
||||
|
||||
public function testGlobalObjectWithDoubleBackSlashString()
|
||||
{
|
||||
$this->assertEquals((object) ['foo'=> 'back\\\\slash'], $GLOBALS['globalObjectWithDoubleBackSlashString']);
|
||||
}
|
||||
}
|
||||
13
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1335/bootstrap1335.php
vendored
Normal file
13
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1335/bootstrap1335.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
$globalString = 'Hello';
|
||||
$globalIntTruthy = 1;
|
||||
$globalIntFalsey = 0;
|
||||
$globalFloat = 1.123;
|
||||
$globalBoolTrue = true;
|
||||
$globalBoolFalse = false;
|
||||
$globalNull = null;
|
||||
$globalArray = ['foo'];
|
||||
$globalNestedArray = [['foo']];
|
||||
$globalObject = (object) ['foo'=> 'bar'];
|
||||
$globalObjectWithBackSlashString = (object) ['foo'=> 'back\\slash'];
|
||||
$globalObjectWithDoubleBackSlashString = (object) ['foo'=> 'back\\\\slash'];
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1337.phpt
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1337.phpt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1337
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--process-isolation';
|
||||
$_SERVER['argv'][3] = 'Issue1337Test';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/1337/Issue1337Test.php';
|
||||
|
||||
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)
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1337/Issue1337Test.php
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1337/Issue1337Test.php
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
class Issue1337Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
public function testProvider($a)
|
||||
{
|
||||
$this->assertTrue($a);
|
||||
}
|
||||
|
||||
public function dataProvider()
|
||||
{
|
||||
return [
|
||||
'c:\\'=> [true],
|
||||
0.9 => [true]
|
||||
];
|
||||
}
|
||||
}
|
||||
34
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1348.phpt
vendored
Normal file
34
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1348.phpt
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1348
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (defined('HHVM_VERSION')) {
|
||||
print 'skip: PHP runtime required';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][] = '--report-useless-tests';
|
||||
$_SERVER['argv'][] = '--process-isolation';
|
||||
$_SERVER['argv'][] = 'Issue1348Test';
|
||||
$_SERVER['argv'][] = __DIR__ . '/1348/Issue1348Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
.
|
||||
STDOUT does not break test result
|
||||
E 2 / 2 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 error:
|
||||
|
||||
1) Issue1348Test::testSTDERR
|
||||
PHPUnit_Framework_Exception: STDERR works as usual.
|
||||
|
||||
ERRORS!
|
||||
Tests: 2, Assertions: 1, Errors: 1.
|
||||
14
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1348/Issue1348Test.php
vendored
Normal file
14
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1348/Issue1348Test.php
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
class Issue1348Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testSTDOUT()
|
||||
{
|
||||
fwrite(STDOUT, "\nSTDOUT does not break test result\n");
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testSTDERR()
|
||||
{
|
||||
fwrite(STDERR, 'STDERR works as usual.');
|
||||
}
|
||||
}
|
||||
46
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1351.phpt
vendored
Normal file
46
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1351.phpt
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1351
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo') || !in_array('sqlite', PDO::getAvailableDrivers())) {
|
||||
print 'skip: PDO_SQLITE is required';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--process-isolation';
|
||||
$_SERVER['argv'][3] = 'Issue1351Test';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/1351/Issue1351Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
F.E.E 5 / 5 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There were 2 errors:
|
||||
|
||||
1) Issue1351Test::testExceptionPre
|
||||
RuntimeException: Expected rethrown exception.
|
||||
%A
|
||||
Caused by
|
||||
LogicException: Expected exception.
|
||||
%A
|
||||
|
||||
2) Issue1351Test::testPhpCoreLanguageException
|
||||
PDOException: SQLSTATE[HY000]: General error: 1 no such table: php_wtf
|
||||
%A
|
||||
|
||||
--
|
||||
|
||||
There was 1 failure:
|
||||
|
||||
1) Issue1351Test::testFailurePre
|
||||
Expected failure.
|
||||
%A
|
||||
ERRORS!
|
||||
Tests: 5, Assertions: 5, Errors: 2, Failures: 1.
|
||||
4
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1351/ChildProcessClass1351.php
vendored
Normal file
4
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1351/ChildProcessClass1351.php
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
class ChildProcessClass1351
|
||||
{
|
||||
}
|
||||
48
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1351/Issue1351Test.php
vendored
Normal file
48
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1351/Issue1351Test.php
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
class Issue1351Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $instance;
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
*/
|
||||
public function testFailurePre()
|
||||
{
|
||||
$this->instance = new ChildProcessClass1351();
|
||||
$this->assertFalse(true, 'Expected failure.');
|
||||
}
|
||||
|
||||
public function testFailurePost()
|
||||
{
|
||||
$this->assertNull($this->instance);
|
||||
$this->assertFalse(class_exists('ChildProcessClass1351', false), 'ChildProcessClass1351 is not loaded.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
*/
|
||||
public function testExceptionPre()
|
||||
{
|
||||
$this->instance = new ChildProcessClass1351();
|
||||
try {
|
||||
throw new LogicException('Expected exception.');
|
||||
} catch (LogicException $e) {
|
||||
throw new RuntimeException('Expected rethrown exception.', 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
public function testExceptionPost()
|
||||
{
|
||||
$this->assertNull($this->instance);
|
||||
$this->assertFalse(class_exists('ChildProcessClass1351', false), 'ChildProcessClass1351 is not loaded.');
|
||||
}
|
||||
|
||||
public function testPhpCoreLanguageException()
|
||||
{
|
||||
// User-space code cannot instantiate a PDOException with a string code,
|
||||
// so trigger a real one.
|
||||
$connection = new PDO('sqlite::memory:');
|
||||
$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$connection->query("DELETE FROM php_wtf WHERE exception_code = 'STRING'");
|
||||
}
|
||||
}
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1374.phpt
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1374.phpt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1374
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue1374Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/1374/Issue1374Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
S 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK, but incomplete, skipped, or risky tests!
|
||||
Tests: 1, Assertions: 0, Skipped: 1.
|
||||
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1374/Issue1374Test.php
vendored
Normal file
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1374/Issue1374Test.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* @requires extension I_DO_NOT_EXIST
|
||||
*/
|
||||
class Issue1374Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
print __FUNCTION__;
|
||||
}
|
||||
|
||||
public function testSomething()
|
||||
{
|
||||
$this->fail('This should not be reached');
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
print __FUNCTION__;
|
||||
}
|
||||
}
|
||||
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1437.phpt
vendored
Normal file
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1437.phpt
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1437
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue1437Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/1437/Issue1437Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
F 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 failure:
|
||||
|
||||
1) Issue1437Test::testFailure
|
||||
Failed asserting that false is true.
|
||||
|
||||
%sIssue1437Test.php:%i
|
||||
|
||||
FAILURES!
|
||||
Tests: 1, Assertions: 1, Failures: 1.
|
||||
9
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1437/Issue1437Test.php
vendored
Normal file
9
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1437/Issue1437Test.php
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
class Issue1437Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testFailure()
|
||||
{
|
||||
ob_start();
|
||||
$this->assertTrue(false);
|
||||
}
|
||||
}
|
||||
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1468.phpt
vendored
Normal file
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1468.phpt
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1468
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--disallow-todo-tests';
|
||||
$_SERVER['argv'][3] = 'Issue1468Test';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/1468/Issue1468Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
I 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK, but incomplete, skipped, or risky tests!
|
||||
Tests: 1, Assertions: 0, Incomplete: 1.
|
||||
11
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1468/Issue1468Test.php
vendored
Normal file
11
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1468/Issue1468Test.php
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
class Issue1468Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @todo Implement this test
|
||||
*/
|
||||
public function testFailure()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
||||
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1471.phpt
vendored
Normal file
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1471.phpt
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1471
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue1471Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/1471/Issue1471Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
F 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 failure:
|
||||
|
||||
1) Issue1471Test::testFailure
|
||||
Failed asserting that false is true.
|
||||
|
||||
%s/Issue1471Test.php:10
|
||||
|
||||
FAILURES!
|
||||
Tests: 1, Assertions: 1, Failures: 1.
|
||||
12
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1471/Issue1471Test.php
vendored
Normal file
12
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1471/Issue1471Test.php
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
class Issue1471Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testFailure()
|
||||
{
|
||||
$this->expectOutputString('*');
|
||||
|
||||
print '*';
|
||||
|
||||
$this->assertTrue(false);
|
||||
}
|
||||
}
|
||||
25
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1472.phpt
vendored
Normal file
25
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1472.phpt
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1472
|
||||
--SKIPIF--
|
||||
<?php
|
||||
// See: https://github.com/facebook/hhvm/issues/4669
|
||||
if (defined('HHVM_VERSION')) {
|
||||
print 'skip: HHVM does not support cloning DOM nodes';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue1472Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/1472/Issue1472Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 4 assertions)
|
||||
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1472/Issue1472Test.php
vendored
Normal file
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1472/Issue1472Test.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
class Issue1472Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testAssertEqualXMLStructure()
|
||||
{
|
||||
$doc = new DOMDocument;
|
||||
$doc->loadXML('<root><label>text content</label></root>');
|
||||
|
||||
$xpath = new DOMXPath($doc);
|
||||
|
||||
$labelElement = $doc->getElementsByTagName('label')->item(0);
|
||||
|
||||
$this->assertEquals(1, $xpath->evaluate('count(//label[text() = "text content"])'));
|
||||
|
||||
$expectedElmt = $doc->createElement('label', 'text content');
|
||||
$this->assertEqualXMLStructure($expectedElmt, $labelElement);
|
||||
|
||||
// the following assertion fails, even though it passed before - which is due to the assertEqualXMLStructure() has modified the $labelElement
|
||||
$this->assertEquals(1, $xpath->evaluate('count(//label[text() = "text content"])'));
|
||||
}
|
||||
}
|
||||
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1570.phpt
vendored
Normal file
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1570.phpt
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/1570
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--disallow-test-output';
|
||||
$_SERVER['argv'][3] = 'Issue1570Test';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/1570/Issue1570Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
R 1 / 1 (100%)*
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK, but incomplete, skipped, or risky tests!
|
||||
Tests: 1, Assertions: 0, Risky: 1.
|
||||
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1570/Issue1570Test.php
vendored
Normal file
8
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/1570/Issue1570Test.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
class Issue1570Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testOne()
|
||||
{
|
||||
print '*';
|
||||
}
|
||||
}
|
||||
28
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2137-filter.phpt
vendored
Normal file
28
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2137-filter.phpt
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
--TEST--
|
||||
#2137: Error message for invalid dataprovider
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue2137Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2137/Issue2137Test.php';
|
||||
$_SERVER['argv'][4] = '--filter';
|
||||
$_SERVER['argv'][5] = 'BrandService';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
W 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 warning:
|
||||
|
||||
1) Warning
|
||||
The data provider specified for Issue2137Test::testBrandService is invalid.
|
||||
Data set #0 is invalid.
|
||||
|
||||
WARNINGS!
|
||||
Tests: 1, Assertions: 0, Warnings: 1.
|
||||
30
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2137-no_filter.phpt
vendored
Normal file
30
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2137-no_filter.phpt
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
--TEST--
|
||||
#2137: Error message for invalid dataprovider
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue2137Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2137/Issue2137Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
WW 2 / 2 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There were 2 warnings:
|
||||
|
||||
1) Warning
|
||||
The data provider specified for Issue2137Test::testBrandService is invalid.
|
||||
Data set #0 is invalid.
|
||||
|
||||
2) Warning
|
||||
The data provider specified for Issue2137Test::testSomethingElseInvalid is invalid.
|
||||
Data set #0 is invalid.
|
||||
|
||||
WARNINGS!
|
||||
Tests: 2, Assertions: 0, Warnings: 2.
|
||||
33
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2137/Issue2137Test.php
vendored
Normal file
33
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2137/Issue2137Test.php
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
class Issue2137Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideBrandService
|
||||
* @param $provided
|
||||
* @param $expected
|
||||
*/
|
||||
public function testBrandService($provided, $expected)
|
||||
{
|
||||
$this->assertSame($provided, $expected);
|
||||
}
|
||||
|
||||
|
||||
public function provideBrandService()
|
||||
{
|
||||
return [
|
||||
//[true, true]
|
||||
new stdClass() // not valid
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider provideBrandService
|
||||
* @param $provided
|
||||
* @param $expected
|
||||
*/
|
||||
public function testSomethingElseInvalid($provided, $expected)
|
||||
{
|
||||
$this->assertSame($provided, $expected);
|
||||
}
|
||||
}
|
||||
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2145.phpt
vendored
Normal file
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2145.phpt
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
--TEST--
|
||||
--stop-on-failure fails to stop on PHP 7
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue2145Test';
|
||||
$_SERVER['argv'][3] = '--stop-on-error';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/2145/Issue2145Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
E
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 error:
|
||||
|
||||
1) Issue2145Test
|
||||
%A
|
||||
ERRORS!
|
||||
Tests: 2, Assertions: 0, Errors: 1.
|
||||
16
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2145/Issue2145Test.php
vendored
Normal file
16
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2145/Issue2145Test.php
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
class Issue2145Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
throw new Exception;
|
||||
}
|
||||
|
||||
public function testOne()
|
||||
{
|
||||
}
|
||||
|
||||
public function testTwo()
|
||||
{
|
||||
}
|
||||
}
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2158.phpt
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2158.phpt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
#2158: Failure to run tests in separate processes if a file included into main process contains constant definition
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue2158Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2158/Issue2158Test.php';
|
||||
|
||||
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
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2158/Issue2158Test.php
vendored
Normal file
23
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2158/Issue2158Test.php
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
class Issue2158Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Set constant in main process
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
include(__DIR__ . '/constant.inc');
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constant defined previously in main process constant should be available and
|
||||
* no errors should be yielded by reload of included files
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
*/
|
||||
public function testSomethingElse()
|
||||
{
|
||||
$this->assertTrue(defined('TEST_CONSTANT'));
|
||||
}
|
||||
}
|
||||
5
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2158/constant.inc
vendored
Normal file
5
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2158/constant.inc
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
define('TEST_CONSTANT', true);
|
||||
|
||||
?>
|
||||
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2299/Issue2299Test.php
vendored
Normal file
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2299/Issue2299Test.php
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Jean Carlo Machado <contato@jeancarlomachado.com.br>
|
||||
*/
|
||||
class Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testOne()
|
||||
{
|
||||
$this->expectExceptionMessage('message');
|
||||
|
||||
throw new Exception('message');
|
||||
}
|
||||
|
||||
public function testTwo()
|
||||
{
|
||||
$this->expectExceptionCode(123);
|
||||
|
||||
throw new Exception('message', 123);
|
||||
}
|
||||
}
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2366.phpt
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2366.phpt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
#2366: Using a test double from a data provider only works once
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue2366Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2366/Issue2366Test.php';
|
||||
|
||||
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)
|
||||
30
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2366/Issue2366Test.php
vendored
Normal file
30
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2366/Issue2366Test.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
class Issue2366
|
||||
{
|
||||
public function foo()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class Issue2366Test extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provider
|
||||
*/
|
||||
public function testOne($o)
|
||||
{
|
||||
$this->assertEquals(1, $o->foo());
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
$o = $this->createMock(Issue2366::class);
|
||||
|
||||
$o->method('foo')->willReturn(1);
|
||||
|
||||
return [
|
||||
[$o],
|
||||
[$o]
|
||||
];
|
||||
}
|
||||
}
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2380.phpt
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2380.phpt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
#2380: Data Providers cannot be generators anymore
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue2380Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2380/Issue2380Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2380/Issue2380Test.php
vendored
Normal file
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2380/Issue2380Test.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class Issue2380Test extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider generatorData
|
||||
*/
|
||||
public function testGeneratorProvider($data)
|
||||
{
|
||||
$this->assertNotEmpty($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Generator
|
||||
*/
|
||||
public function generatorData()
|
||||
{
|
||||
yield ['testing'];
|
||||
}
|
||||
}
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2382.phpt
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2382.phpt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
#2382: Data Providers throw error with uncloneable object
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue2382Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2382/Issue2382Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2382/Issue2382Test.php
vendored
Normal file
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2382/Issue2382Test.php
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class Issue2382Test extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
public function testOne($test)
|
||||
{
|
||||
$this->assertInstanceOf(\Exception::class, $test);
|
||||
}
|
||||
|
||||
public function dataProvider()
|
||||
{
|
||||
return [
|
||||
[
|
||||
$this->getMockBuilder(\Exception::class)->getMock()
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2435.phpt
vendored
Normal file
20
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2435.phpt
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
--TEST--
|
||||
GH-2435: Test empty @group annotation
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue2435Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/2435/Issue2435Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
12
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2435/Issue2435Test.php
vendored
Normal file
12
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/2435/Issue2435Test.php
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group
|
||||
*/
|
||||
class Issue2435Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testOne()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
32
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/244.phpt
vendored
Normal file
32
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/244.phpt
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
--TEST--
|
||||
GH-244: Expected Exception should support string codes
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--process-isolation';
|
||||
$_SERVER['argv'][3] = 'Issue244Test';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/244/Issue244Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
.FFF 4 / 4 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There were 3 failures:
|
||||
|
||||
1) Issue244Test::testFails
|
||||
Failed asserting that '123StringCode' is equal to expected exception code 'OtherString'.
|
||||
|
||||
2) Issue244Test::testFailsTooIfExpectationIsANumber
|
||||
Failed asserting that '123StringCode' is equal to expected exception code 123.
|
||||
|
||||
3) Issue244Test::testFailsTooIfExceptionCodeIsANumber
|
||||
Failed asserting that 123 is equal to expected exception code '123String'.
|
||||
|
||||
FAILURES!
|
||||
Tests: 4, Assertions: 8, Failures: 3.
|
||||
55
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/244/Issue244Test.php
vendored
Normal file
55
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/244/Issue244Test.php
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
class Issue244Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException Issue244Exception
|
||||
* @expectedExceptionCode 123StringCode
|
||||
*/
|
||||
public function testWorks()
|
||||
{
|
||||
throw new Issue244Exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Issue244Exception
|
||||
* @expectedExceptionCode OtherString
|
||||
*/
|
||||
public function testFails()
|
||||
{
|
||||
throw new Issue244Exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Issue244Exception
|
||||
* @expectedExceptionCode 123
|
||||
*/
|
||||
public function testFailsTooIfExpectationIsANumber()
|
||||
{
|
||||
throw new Issue244Exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Issue244ExceptionIntCode
|
||||
* @expectedExceptionCode 123String
|
||||
*/
|
||||
public function testFailsTooIfExceptionCodeIsANumber()
|
||||
{
|
||||
throw new Issue244ExceptionIntCode;
|
||||
}
|
||||
}
|
||||
|
||||
class Issue244Exception extends Exception
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->code = '123StringCode';
|
||||
}
|
||||
}
|
||||
|
||||
class Issue244ExceptionIntCode extends Exception
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->code = 123;
|
||||
}
|
||||
}
|
||||
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/322.phpt
vendored
Normal file
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/322.phpt
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
--TEST--
|
||||
GH-322: group commandline option should override group/exclude setting in phpunit.xml
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--configuration';
|
||||
$_SERVER['argv'][2] = __DIR__ . '/322/phpunit322.xml';
|
||||
$_SERVER['argv'][3] = '--debug';
|
||||
$_SERVER['argv'][4] = '--group';
|
||||
$_SERVER['argv'][5] = 'one';
|
||||
$_SERVER['argv'][6] = 'Issue322Test';
|
||||
$_SERVER['argv'][7] = __DIR__ . '/322/Issue322Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
|
||||
Starting test 'Issue322Test::testOne'.
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 0 assertions)
|
||||
17
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/322/Issue322Test.php
vendored
Normal file
17
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/322/Issue322Test.php
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
class Issue322Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @group one
|
||||
*/
|
||||
public function testOne()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @group two
|
||||
*/
|
||||
public function testTwo()
|
||||
{
|
||||
}
|
||||
}
|
||||
11
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/322/phpunit322.xml
vendored
Normal file
11
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/322/phpunit322.xml
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<phpunit>
|
||||
<testsuite name="My Test Suite">
|
||||
<file>Test.php</file>
|
||||
</testsuite>
|
||||
|
||||
<groups>
|
||||
<exclude>
|
||||
<group>one</group>
|
||||
</exclude>
|
||||
</groups>
|
||||
</phpunit>
|
||||
31
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/433.phpt
vendored
Normal file
31
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/433.phpt
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
--TEST--
|
||||
GH-433: expectOutputString not completely working as expected
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue433Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/433/Issue433Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
..F 3 / 3 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 failure:
|
||||
|
||||
1) Issue433Test::testNotMatchingOutput
|
||||
Failed asserting that two strings are equal.
|
||||
--- Expected
|
||||
+++ Actual
|
||||
@@ @@
|
||||
-'foo'
|
||||
+'bar'
|
||||
|
||||
FAILURES!
|
||||
Tests: 3, Assertions: 3, Failures: 1.
|
||||
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/433/Issue433Test.php
vendored
Normal file
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/433/Issue433Test.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
class Issue433Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testOutputWithExpectationBefore()
|
||||
{
|
||||
$this->expectOutputString('test');
|
||||
print 'test';
|
||||
}
|
||||
|
||||
public function testOutputWithExpectationAfter()
|
||||
{
|
||||
print 'test';
|
||||
$this->expectOutputString('test');
|
||||
}
|
||||
|
||||
public function testNotMatchingOutput()
|
||||
{
|
||||
print 'bar';
|
||||
$this->expectOutputString('foo');
|
||||
}
|
||||
}
|
||||
32
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/445.phpt
vendored
Normal file
32
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/445.phpt
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
--TEST--
|
||||
GH-455: expectOutputString not working in strict mode
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--disallow-test-output';
|
||||
$_SERVER['argv'][3] = 'Issue445Test';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/445/Issue445Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
..F 3 / 3 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 failure:
|
||||
|
||||
1) Issue445Test::testNotMatchingOutput
|
||||
Failed asserting that two strings are equal.
|
||||
--- Expected
|
||||
+++ Actual
|
||||
@@ @@
|
||||
-'foo'
|
||||
+'bar'
|
||||
|
||||
FAILURES!
|
||||
Tests: 3, Assertions: 3, Failures: 1.
|
||||
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/445/Issue445Test.php
vendored
Normal file
21
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/445/Issue445Test.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
class Issue445Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testOutputWithExpectationBefore()
|
||||
{
|
||||
$this->expectOutputString('test');
|
||||
print 'test';
|
||||
}
|
||||
|
||||
public function testOutputWithExpectationAfter()
|
||||
{
|
||||
print 'test';
|
||||
$this->expectOutputString('test');
|
||||
}
|
||||
|
||||
public function testNotMatchingOutput()
|
||||
{
|
||||
print 'bar';
|
||||
$this->expectOutputString('foo');
|
||||
}
|
||||
}
|
||||
29
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/498.phpt
vendored
Normal file
29
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/498.phpt
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
--TEST--
|
||||
GH-498: The test methods won't be run if a dataProvider throws Exception and --group is added in command line
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--group';
|
||||
$_SERVER['argv'][3] = 'trueOnly';
|
||||
$_SERVER['argv'][4] = 'Issue498Test';
|
||||
$_SERVER['argv'][5] = __DIR__ . '/498/Issue498Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
W 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 warning:
|
||||
|
||||
1) Warning
|
||||
The data provider specified for Issue498Test::shouldBeFalse is invalid.
|
||||
Can't create the data
|
||||
|
||||
WARNINGS!
|
||||
Tests: 1, Assertions: 0, Warnings: 1.
|
||||
44
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/498/Issue498Test.php
vendored
Normal file
44
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/498/Issue498Test.php
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class Issue498Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider shouldBeTrueDataProvider
|
||||
* @group falseOnly
|
||||
*/
|
||||
public function shouldBeTrue($testData)
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider shouldBeFalseDataProvider
|
||||
* @group trueOnly
|
||||
*/
|
||||
public function shouldBeFalse($testData)
|
||||
{
|
||||
$this->assertFalse(false);
|
||||
}
|
||||
|
||||
public function shouldBeTrueDataProvider()
|
||||
{
|
||||
|
||||
//throw new Exception("Can't create the data");
|
||||
return [
|
||||
[true],
|
||||
[false]
|
||||
];
|
||||
}
|
||||
|
||||
public function shouldBeFalseDataProvider()
|
||||
{
|
||||
throw new Exception("Can't create the data");
|
||||
|
||||
return [
|
||||
[true],
|
||||
[false]
|
||||
];
|
||||
}
|
||||
}
|
||||
33
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/503.phpt
vendored
Normal file
33
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/503.phpt
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
--TEST--
|
||||
GH-503: assertEquals() Line Ending Differences Are Obscure
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue503Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/503/Issue503Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
F 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 failure:
|
||||
|
||||
1) Issue503Test::testCompareDifferentLineEndings
|
||||
Failed asserting that two strings are identical.
|
||||
--- Expected
|
||||
+++ Actual
|
||||
@@ @@
|
||||
#Warning: Strings contain different line endings!
|
||||
foo
|
||||
|
||||
%s:%i
|
||||
|
||||
FAILURES!
|
||||
Tests: 1, Assertions: 1, Failures: 1.
|
||||
11
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/503/Issue503Test.php
vendored
Normal file
11
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/503/Issue503Test.php
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
class Issue503Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCompareDifferentLineEndings()
|
||||
{
|
||||
$this->assertSame(
|
||||
"foo\n",
|
||||
"foo\r\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
42
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/581.phpt
vendored
Normal file
42
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/581.phpt
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
--TEST--
|
||||
GH-581: PHPUnit_Util_Type::export adds extra newlines in Windows
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue581Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/581/Issue581Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
F 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 failure:
|
||||
|
||||
1) Issue581Test::testExportingObjectsDoesNotBreakWindowsLineFeeds
|
||||
Failed asserting that two objects are equal.
|
||||
--- Expected
|
||||
+++ Actual
|
||||
@@ @@
|
||||
stdClass Object (
|
||||
0 => 1
|
||||
1 => 2
|
||||
2 => 'Test\n'
|
||||
3 => 4
|
||||
- 4 => 5
|
||||
+ 4 => 1
|
||||
5 => 6
|
||||
6 => 7
|
||||
7 => 8
|
||||
)
|
||||
|
||||
%s:%i
|
||||
|
||||
FAILURES!
|
||||
Tests: 1, Assertions: 1, Failures: 1.
|
||||
11
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/581/Issue581Test.php
vendored
Normal file
11
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/581/Issue581Test.php
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
class Issue581Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testExportingObjectsDoesNotBreakWindowsLineFeeds()
|
||||
{
|
||||
$this->assertEquals(
|
||||
(object) [1, 2, "Test\r\n", 4, 5, 6, 7, 8],
|
||||
(object) [1, 2, "Test\r\n", 4, 1, 6, 7, 8]
|
||||
);
|
||||
}
|
||||
}
|
||||
28
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/74.phpt
vendored
Normal file
28
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/74.phpt
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
--TEST--
|
||||
GH-74: catchable fatal error in 3.5
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--process-isolation';
|
||||
$_SERVER['argv'][3] = 'Issue74Test';
|
||||
$_SERVER['argv'][4] = __DIR__ . '/74/Issue74Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
E 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 error:
|
||||
|
||||
1) Issue74Test::testCreateAndThrowNewExceptionInProcessIsolation
|
||||
NewException: Testing GH-74
|
||||
|
||||
%sIssue74Test.php:7
|
||||
|
||||
ERRORS!
|
||||
Tests: 1, Assertions: 0, Errors: 1.
|
||||
9
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/74/Issue74Test.php
vendored
Normal file
9
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/74/Issue74Test.php
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
class Issue74Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCreateAndThrowNewExceptionInProcessIsolation()
|
||||
{
|
||||
require_once __DIR__ . '/NewException.php';
|
||||
throw new NewException('Testing GH-74');
|
||||
}
|
||||
}
|
||||
4
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/74/NewException.php
vendored
Normal file
4
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/74/NewException.php
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
class NewException extends Exception
|
||||
{
|
||||
}
|
||||
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/765.phpt
vendored
Normal file
26
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/765.phpt
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
--TEST--
|
||||
GH-765: Fatal error triggered in PHPUnit when exception is thrown in data provider of a test with a dependency
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue765Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/765/Issue765Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
.W 2 / 2 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 warning:
|
||||
|
||||
1) Warning
|
||||
The data provider specified for Issue765Test::testDependent is invalid.
|
||||
|
||||
WARNINGS!
|
||||
Tests: 2, Assertions: 1, Warnings: 1.
|
||||
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/765/Issue765Test.php
vendored
Normal file
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/765/Issue765Test.php
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
class Issue765Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testDependee()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testDependee
|
||||
* @dataProvider dependentProvider
|
||||
*/
|
||||
public function testDependent($a)
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function dependentProvider()
|
||||
{
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/797.phpt
vendored
Normal file
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/797.phpt
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
--TEST--
|
||||
GH-797: Disabled $preserveGlobalState does not load bootstrap.php.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][] = '--process-isolation';
|
||||
$_SERVER['argv'][] = '--bootstrap';
|
||||
$_SERVER['argv'][] = __DIR__ . '/797/bootstrap797.php';
|
||||
$_SERVER['argv'][] = __DIR__ . '/797/Issue797Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
10
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/797/Issue797Test.php
vendored
Normal file
10
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/797/Issue797Test.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
class Issue797Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $preserveGlobalState = false;
|
||||
|
||||
public function testBootstrapPhpIsExecutedInIsolation()
|
||||
{
|
||||
$this->assertEquals(GITHUB_ISSUE, 797);
|
||||
}
|
||||
}
|
||||
6
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/797/bootstrap797.php
vendored
Normal file
6
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/797/bootstrap797.php
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
// If process isolation fails to include this file, then
|
||||
// PHPUnit_Framework_TestCase itself does not exist. :-)
|
||||
require __DIR__ . '/../../../bootstrap.php';
|
||||
|
||||
const GITHUB_ISSUE = 797;
|
||||
24
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/863.phpt
vendored
Normal file
24
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/863.phpt
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
--TEST--
|
||||
GH-863: Number of tests to run calculated incorrectly when --repeat is used
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--repeat';
|
||||
$_SERVER['argv'][3] = '50';
|
||||
$_SERVER['argv'][4] = 'BankAccountTest';
|
||||
$_SERVER['argv'][5] = dirname(dirname(__DIR__)) . '/_files/BankAccountTest.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
............................................................... 63 / 150 ( 42%)
|
||||
............................................................... 126 / 150 ( 84%)
|
||||
........................ 150 / 150 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (150 tests, 150 assertions)
|
||||
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/873-php5.phpt
vendored
Normal file
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/873-php5.phpt
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
--TEST--
|
||||
GH-873: PHPUnit suppresses exceptions thrown outside of test case function
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_MAJOR_VERSION > 5) {
|
||||
print 'skip: PHP 5 is required';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue873Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/873/Issue873Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Fatal error: Uncaught exception 'Exception' with message 'PHPUnit suppresses exceptions thrown outside of test case function' in %s:%i
|
||||
Stack trace:
|
||||
%a
|
||||
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/873-php7.phpt
vendored
Normal file
22
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/873-php7.phpt
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
--TEST--
|
||||
GH-873: PHPUnit suppresses exceptions thrown outside of test case function
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_MAJOR_VERSION < 7) {
|
||||
print 'skip: PHP 7 is required';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue873Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/873/Issue873Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Fatal error: Uncaught Exception: PHPUnit suppresses exceptions thrown outside of test case function in %s:%i
|
||||
Stack trace:
|
||||
%a
|
||||
9
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/873/Issue873Test.php
vendored
Normal file
9
pfosten/vendor/phpunit/phpunit/tests/Regression/GitHub/873/Issue873Test.php
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
if (extension_loaded('xdebug')) {
|
||||
xdebug_disable();
|
||||
}
|
||||
|
||||
throw new Exception(
|
||||
'PHPUnit suppresses exceptions thrown outside of test case function'
|
||||
);
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/Trac/1021.phpt
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/Trac/1021.phpt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
#1021: Depending on a test that uses a data provider does not work
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue1021Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/1021/Issue1021Test.php';
|
||||
|
||||
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, 1 assertion)
|
||||
23
pfosten/vendor/phpunit/phpunit/tests/Regression/Trac/1021/Issue1021Test.php
vendored
Normal file
23
pfosten/vendor/phpunit/phpunit/tests/Regression/Trac/1021/Issue1021Test.php
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
class Issue1021Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provider
|
||||
*/
|
||||
public function testSomething($data)
|
||||
{
|
||||
$this->assertTrue($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSomething
|
||||
*/
|
||||
public function testSomethingElse()
|
||||
{
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return [[true]];
|
||||
}
|
||||
}
|
||||
19
pfosten/vendor/phpunit/phpunit/tests/Regression/Trac/523.phpt
vendored
Normal file
19
pfosten/vendor/phpunit/phpunit/tests/Regression/Trac/523.phpt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
#523: assertAttributeEquals does not work with classes extending ArrayIterator
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = 'Issue523Test';
|
||||
$_SERVER['argv'][3] = __DIR__ . '/523/Issue523Test.php';
|
||||
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit_TextUI_Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
13
pfosten/vendor/phpunit/phpunit/tests/Regression/Trac/523/Issue523Test.php
vendored
Normal file
13
pfosten/vendor/phpunit/phpunit/tests/Regression/Trac/523/Issue523Test.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
class Issue523Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testAttributeEquals()
|
||||
{
|
||||
$this->assertAttributeEquals('foo', 'field', new Issue523());
|
||||
}
|
||||
};
|
||||
|
||||
class Issue523 extends ArrayIterator
|
||||
{
|
||||
protected $field = 'foo';
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue