mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-60611 phpunit: switch to namespaced phunit classes
This commit is contained in:
parent
1322351b92
commit
801a372dad
@ -74,7 +74,7 @@ if ($options['run']) {
|
||||
}
|
||||
}
|
||||
$_SERVER['argv'] = array_values($_SERVER['argv']);
|
||||
PHPUnit_TextUI_Command::main();
|
||||
PHPUnit\TextUI\Command::main();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,7 @@ class core_files_zip_packer_testcase extends advanced_testcase implements file_p
|
||||
$result = $zip_archive->close();
|
||||
} catch (Exception $e) {
|
||||
// New PHP versions print PHP Warning.
|
||||
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
|
||||
$this->assertContains('ZipArchive::close', $e->getMessage());
|
||||
}
|
||||
// This is crazy, but it shows how some PHP versions do return true.
|
||||
@ -472,7 +472,7 @@ class core_files_zip_packer_testcase extends advanced_testcase implements file_p
|
||||
$this->assertFalse($result);
|
||||
} catch (Exception $e) {
|
||||
// But others do insist into returning true (5.6.13...). Only can accept them.
|
||||
$this->assertInstanceOf('PHPUnit_Framework_ExpectationFailedException', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\ExpectationFailedException', $e);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
$this->assertFileNotExists($archive);
|
||||
|
@ -72,7 +72,7 @@ if (defined('CLI_SCRIPT')) {
|
||||
}
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
$phpunitversion = PHPUnit_Runner_Version::id();
|
||||
$phpunitversion = PHPUnit\Runner\Version::id();
|
||||
if ($phpunitversion === '@package_version@') {
|
||||
// library checked out from git, let's hope dev knows that 3.6.0 is required
|
||||
} else if (version_compare($phpunitversion, '3.6.0', 'lt')) {
|
||||
@ -80,10 +80,6 @@ if ($phpunitversion === '@package_version@') {
|
||||
}
|
||||
unset($phpunitversion);
|
||||
|
||||
if (!include_once('PHPUnit/Extensions/Database/Autoload.php')) {
|
||||
phpunit_bootstrap_error(PHPUNIT_EXITCODE_PHPUNITEXTMISSING, 'phpunit/DbUnit');
|
||||
}
|
||||
|
||||
define('NO_OUTPUT_BUFFERING', true);
|
||||
|
||||
// only load CFG from config.php, stop ASAP in lib/setup.php
|
||||
|
@ -135,9 +135,9 @@ abstract class advanced_testcase extends base_testcase {
|
||||
// make sure test did not forget to close transaction
|
||||
if ($DB->is_transaction_started()) {
|
||||
self::resetAllData();
|
||||
if ($this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED
|
||||
or $this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED
|
||||
or $this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) {
|
||||
if ($this->getStatus() == PHPUnit\Runner\BaseTestRunner::STATUS_PASSED
|
||||
or $this->getStatus() == PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED
|
||||
or $this->getStatus() == PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE) {
|
||||
throw new coding_exception('Test '.$this->getName().' did not close database transaction');
|
||||
}
|
||||
}
|
||||
@ -147,20 +147,20 @@ abstract class advanced_testcase extends base_testcase {
|
||||
* Creates a new FlatXmlDataSet with the given $xmlFile. (absolute path.)
|
||||
*
|
||||
* @param string $xmlFile
|
||||
* @return PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet
|
||||
* @return PHPUnit\DbUnit\DataSet\FlatXmlDataSet
|
||||
*/
|
||||
protected function createFlatXMLDataSet($xmlFile) {
|
||||
return new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet($xmlFile);
|
||||
return new PHPUnit\DbUnit\DataSet\FlatXmlDataSet($xmlFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new XMLDataSet with the given $xmlFile. (absolute path.)
|
||||
*
|
||||
* @param string $xmlFile
|
||||
* @return PHPUnit_Extensions_Database_DataSet_XmlDataSet
|
||||
* @return PHPUnit\DbUnit\DataSet\XmlDataSet
|
||||
*/
|
||||
protected function createXMLDataSet($xmlFile) {
|
||||
return new PHPUnit_Extensions_Database_DataSet_XmlDataSet($xmlFile);
|
||||
return new PHPUnit\DbUnit\DataSet\XmlDataSet($xmlFile);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,10 +170,10 @@ abstract class advanced_testcase extends base_testcase {
|
||||
* @param string $delimiter
|
||||
* @param string $enclosure
|
||||
* @param string $escape
|
||||
* @return PHPUnit_Extensions_Database_DataSet_CsvDataSet
|
||||
* @return PHPUnit\DbUnit\DataSet\CsvDataSet
|
||||
*/
|
||||
protected function createCsvDataSet($files, $delimiter = ',', $enclosure = '"', $escape = '"') {
|
||||
$dataSet = new PHPUnit_Extensions_Database_DataSet_CsvDataSet($delimiter, $enclosure, $escape);
|
||||
$dataSet = new PHPUnit\DbUnit\DataSet\CsvDataSet($delimiter, $enclosure, $escape);
|
||||
foreach($files as $table=>$file) {
|
||||
$dataSet->addTable($table, $file);
|
||||
}
|
||||
@ -195,10 +195,10 @@ abstract class advanced_testcase extends base_testcase {
|
||||
*
|
||||
* Note: it is usually better to use data generators
|
||||
*
|
||||
* @param PHPUnit_Extensions_Database_DataSet_IDataSet $dataset
|
||||
* @param PHPUnit\DbUnit\DataSet\IDataSet $dataset
|
||||
* @return void
|
||||
*/
|
||||
protected function loadDataSet(PHPUnit_Extensions_Database_DataSet_IDataSet $dataset) {
|
||||
protected function loadDataSet(PHPUnit\DbUnit\DataSet\IDataSet $dataset) {
|
||||
global $DB;
|
||||
|
||||
$structure = phpunit_util::get_tablestructure();
|
||||
|
@ -33,7 +33,7 @@
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class phpunit_ArrayDataSet extends PHPUnit_Extensions_Database_DataSet_AbstractDataSet {
|
||||
class phpunit_ArrayDataSet extends PHPUnit\DbUnit\DataSet\AbstractDataSet {
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
@ -58,8 +58,8 @@ class phpunit_ArrayDataSet extends PHPUnit_Extensions_Database_DataSet_AbstractD
|
||||
$columns = array_keys($firstrow);
|
||||
}
|
||||
|
||||
$metaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($tableName, $columns);
|
||||
$table = new PHPUnit_Extensions_Database_DataSet_DefaultTable($metaData);
|
||||
$metaData = new PHPUnit\DbUnit\DataSet\DefaultTableMetaData($tableName, $columns);
|
||||
$table = new PHPUnit\DbUnit\DataSet\DefaultTable($metaData);
|
||||
|
||||
foreach ($rows AS $row) {
|
||||
if ($columnsInFirstRow) {
|
||||
@ -72,7 +72,7 @@ class phpunit_ArrayDataSet extends PHPUnit_Extensions_Database_DataSet_AbstractD
|
||||
}
|
||||
|
||||
protected function createIterator($reverse = FALSE) {
|
||||
return new PHPUnit_Extensions_Database_DataSet_DefaultTableIterator($this->tables, $reverse);
|
||||
return new PHPUnit\DbUnit\DataSet\DefaultTableIterator($this->tables, $reverse);
|
||||
}
|
||||
|
||||
public function getTable($tableName) {
|
||||
|
@ -42,7 +42,7 @@
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class phpunit_autoloader implements PHPUnit_Runner_TestSuiteLoader {
|
||||
class phpunit_autoloader implements \PHPUnit\Runner\TestSuiteLoader {
|
||||
public function load($suiteClassName, $suiteClassFile = '') {
|
||||
global $CFG;
|
||||
|
||||
@ -66,13 +66,13 @@ class phpunit_autoloader implements PHPUnit_Runner_TestSuiteLoader {
|
||||
}
|
||||
|
||||
if ($suiteClassFile) {
|
||||
PHPUnit_Util_Fileloader::checkAndLoad($suiteClassFile);
|
||||
PHPUnit\Util\Fileloader::checkAndLoad($suiteClassFile);
|
||||
if (class_exists($suiteClassName, false)) {
|
||||
$class = new ReflectionClass($suiteClassName);
|
||||
return $class;
|
||||
}
|
||||
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
throw new PHPUnit\Framework\Exception(
|
||||
sprintf("Class '%s' could not be found in '%s'.", $suiteClassName, $suiteClassFile)
|
||||
);
|
||||
}
|
||||
@ -155,7 +155,7 @@ class phpunit_autoloader implements PHPUnit_Runner_TestSuiteLoader {
|
||||
}
|
||||
}
|
||||
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
throw new PHPUnit\Framework\Exception(
|
||||
sprintf("Class '%s' could not be found in '%s'.", $suiteClassName, $suiteClassFile)
|
||||
);
|
||||
}
|
||||
@ -165,7 +165,7 @@ class phpunit_autoloader implements PHPUnit_Runner_TestSuiteLoader {
|
||||
// class name. Let's throw fatal error if there are more testcases in one file.
|
||||
|
||||
$classes = get_declared_classes();
|
||||
PHPUnit_Util_Fileloader::checkAndLoad($file);
|
||||
PHPUnit\Util\Fileloader::checkAndLoad($file);
|
||||
$includePathFilename = stream_resolve_include_path($file);
|
||||
$loadedClasses = array_diff(get_declared_classes(), $classes);
|
||||
|
||||
@ -174,7 +174,7 @@ class phpunit_autoloader implements PHPUnit_Runner_TestSuiteLoader {
|
||||
foreach ($loadedClasses as $loadedClass) {
|
||||
$class = new ReflectionClass($loadedClass);
|
||||
|
||||
if ($class->isSubclassOf('PHPUnit_Framework_TestCase') and !$class->isAbstract()) {
|
||||
if ($class->isSubclassOf('PHPUnit\Framework\TestCase') and !$class->isAbstract()) {
|
||||
if (realpath($includePathFilename) === realpath($class->getFileName())) {
|
||||
$candidates[] = $loadedClass;
|
||||
}
|
||||
@ -182,13 +182,13 @@ class phpunit_autoloader implements PHPUnit_Runner_TestSuiteLoader {
|
||||
}
|
||||
|
||||
if (count($candidates) == 0) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
throw new PHPUnit\Framework\Exception(
|
||||
sprintf("File '%s' does not contain any test cases.", $file)
|
||||
);
|
||||
}
|
||||
|
||||
if (count($candidates) > 1) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
throw new PHPUnit\Framework\Exception(
|
||||
sprintf("File '%s' contains multiple test cases: ".implode(', ', $candidates), $file)
|
||||
);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* @copyright 2015 Blackboard (http://www.blackboard.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class base_testcase extends PHPUnit_Framework_TestCase {
|
||||
abstract class base_testcase extends PHPUnit\Framework\TestCase {
|
||||
// @codingStandardsIgnoreStart
|
||||
// Following code is legacy code from phpunit to support assertTag
|
||||
// and assertNotTag.
|
||||
@ -53,7 +53,7 @@ abstract class base_testcase extends PHPUnit_Framework_TestCase {
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
public static function assertTag($matcher, $actual, $message = '', $ishtml = true) {
|
||||
$dom = PHPUnit_Util_XML::load($actual, $ishtml);
|
||||
$dom = PHPUnit\Util\XML::load($actual, $ishtml);
|
||||
$tags = self::findNodes($dom, $matcher, $ishtml);
|
||||
$matched = count($tags) > 0 && $tags[0] instanceof DOMNode;
|
||||
self::assertTrue($matched, $message);
|
||||
@ -71,7 +71,7 @@ abstract class base_testcase extends PHPUnit_Framework_TestCase {
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
public static function assertNotTag($matcher, $actual, $message = '', $ishtml = true) {
|
||||
$dom = PHPUnit_Util_XML::load($actual, $ishtml);
|
||||
$dom = PHPUnit\Util\XML::load($actual, $ishtml);
|
||||
$tags = self::findNodes($dom, $matcher, $ishtml);
|
||||
$matched = (is_array($tags) && count($tags) > 0) && $tags[0] instanceof DOMNode;
|
||||
self::assertFalse($matched, $message);
|
||||
@ -85,7 +85,7 @@ abstract class base_testcase extends PHPUnit_Framework_TestCase {
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws PHPUnit_Framework_Exception
|
||||
* @throws PHPUnit\Framework\Exception
|
||||
*/
|
||||
public static function assertValidKeys(array $hash, array $validKeys) {
|
||||
$valids = array();
|
||||
@ -106,7 +106,7 @@ abstract class base_testcase extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
if (!empty($unknown)) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
throw new PHPUnit\Framework\Exception(
|
||||
'Unknown key(s): ' . implode(', ', $unknown)
|
||||
);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
* @copyright 2015 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class phpunit_constraint_object_is_equal_with_exceptions extends PHPUnit_Framework_Constraint_IsEqual {
|
||||
class phpunit_constraint_object_is_equal_with_exceptions extends PHPUnit\Framework\Constraint\IsEqual {
|
||||
|
||||
/**
|
||||
* @var array $keys The list of exceptions.
|
||||
@ -41,7 +41,7 @@ class phpunit_constraint_object_is_equal_with_exceptions extends PHPUnit_Framewo
|
||||
|
||||
/**
|
||||
* Add an exception for the named key to use a different comparison
|
||||
* method. Any assertion provided by PHPUnit_Framework_Assert is
|
||||
* method. Any assertion provided by PHPUnit\Framework\Assert is
|
||||
* acceptable.
|
||||
*
|
||||
* @param string $key The key to except.
|
||||
@ -65,13 +65,13 @@ class phpunit_constraint_object_is_equal_with_exceptions extends PHPUnit_Framewo
|
||||
* @param string $description Additional information about the test
|
||||
* @param bool $shouldreturnesult Whether to return a result or throw an exception
|
||||
* @return mixed
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
* @throws PHPUnit\Framework\ExpectationFailedException
|
||||
*/
|
||||
public function evaluate($other, $description = '', $shouldreturnesult = false) {
|
||||
foreach ($this->keys as $key => $comparison) {
|
||||
if (isset($other->$key) || isset($this->value->$key)) {
|
||||
// One of the keys is present, therefore run the comparison.
|
||||
PHPUnit_Framework_Assert::$comparison($this->value->$key, $other->$key);
|
||||
PHPUnit\Framework\Assert::$comparison($this->value->$key, $other->$key);
|
||||
|
||||
// Unset the keys, otherwise the standard evaluation will take place.
|
||||
unset($other->$key);
|
||||
|
@ -33,12 +33,12 @@
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class Hint_ResultPrinter extends PHPUnit_TextUI_ResultPrinter {
|
||||
class Hint_ResultPrinter extends PHPUnit\TextUI\ResultPrinter {
|
||||
public function __construct() {
|
||||
// ARRGH - PHPUnit does not give us commandline arguments or xml config, so let's hack hard!
|
||||
if (defined('DEBUG_BACKTRACE_PROVIDE_OBJECT')) {
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
|
||||
if (isset($backtrace[2]['object']) and ($backtrace[2]['object'] instanceof PHPUnit_TextUI_Command)) {
|
||||
if (isset($backtrace[2]['object']) and ($backtrace[2]['object'] instanceof PHPUnit\TextUI\Command)) {
|
||||
list($verbose, $colors, $debug) = Hacky_TextUI_Command_reader::get_settings_hackery($backtrace[2]['object']);
|
||||
parent::__construct(null, $verbose, $colors, $debug);
|
||||
return;
|
||||
@ -48,7 +48,7 @@ class Hint_ResultPrinter extends PHPUnit_TextUI_ResultPrinter {
|
||||
parent::__construct(null, false, self::COLOR_DEFAULT, false);
|
||||
}
|
||||
|
||||
protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect) {
|
||||
protected function printDefectTrace(PHPUnit\Framework\TestFailure $defect) {
|
||||
global $CFG;
|
||||
|
||||
parent::printDefectTrace($defect);
|
||||
@ -129,10 +129,10 @@ class Hint_ResultPrinter extends PHPUnit_TextUI_ResultPrinter {
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class Hacky_TextUI_Command_reader extends PHPUnit_TextUI_Command {
|
||||
public static function get_settings_hackery(PHPUnit_TextUI_Command $toread) {
|
||||
class Hacky_TextUI_Command_reader extends PHPUnit\TextUI\Command {
|
||||
public static function get_settings_hackery(PHPUnit\TextUI\Command $toread) {
|
||||
$arguments = $toread->arguments;
|
||||
$config = PHPUnit_Util_Configuration::getInstance($arguments['configuration'])->getPHPUnitConfiguration();
|
||||
$config = PHPUnit\Util\Configuration::getInstance($arguments['configuration'])->getPHPUnitConfiguration();
|
||||
|
||||
$verbose = isset($config['verbose']) ? $config['verbose'] : false;
|
||||
$verbose = isset($arguments['verbose']) ? $arguments['verbose'] : $verbose;
|
||||
|
@ -621,7 +621,7 @@ class phpunit_util extends testing_util {
|
||||
|
||||
foreach ($backtrace as $bt) {
|
||||
if (isset($bt['object']) and is_object($bt['object'])
|
||||
&& $bt['object'] instanceof PHPUnit_Framework_TestCase) {
|
||||
&& $bt['object'] instanceof PHPUnit\Framework\TestCase) {
|
||||
$debug = new stdClass();
|
||||
$debug->message = $message;
|
||||
$debug->level = $level;
|
||||
|
@ -199,7 +199,7 @@
|
||||
<xs:attribute name="convertNoticesToExceptions" type="xs:boolean" default="true"/>
|
||||
<xs:attribute name="convertWarningsToExceptions" type="xs:boolean" default="true"/>
|
||||
<xs:attribute name="forceCoversAnnotation" type="xs:boolean" default="false"/>
|
||||
<xs:attribute name="printerClass" type="xs:string" default="PHPUnit_TextUI_ResultPrinter"/>
|
||||
<xs:attribute name="printerClass" type="xs:string" default="PHPUnit\TextUI\ResultPrinter"/>
|
||||
<xs:attribute name="printerFile" type="xs:anyURI"/>
|
||||
<xs:attribute name="processIsolation" type="xs:boolean" default="false"/>
|
||||
<xs:attribute name="stopOnError" type="xs:boolean" default="false"/>
|
||||
@ -221,7 +221,7 @@
|
||||
<xs:attribute name="timeoutForSmallTests" type="xs:integer" default="1"/>
|
||||
<xs:attribute name="timeoutForMediumTests" type="xs:integer" default="10"/>
|
||||
<xs:attribute name="timeoutForLargeTests" type="xs:integer" default="60"/>
|
||||
<xs:attribute name="testSuiteLoaderClass" type="xs:string" default="PHPUnit_Runner_StandardTestSuiteLoader"/>
|
||||
<xs:attribute name="testSuiteLoaderClass" type="xs:string" default="PHPUnit\Runner\StandardTestSuiteLoader"/>
|
||||
<xs:attribute name="testSuiteLoaderFile" type="xs:anyURI"/>
|
||||
<xs:attribute name="verbose" type="xs:boolean" default="false"/>
|
||||
<xs:attribute name="stderr" type="xs:boolean" default="false"/>
|
||||
|
@ -223,7 +223,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
|
||||
try {
|
||||
self::resetAllData(true);
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
|
||||
}
|
||||
$this->assertEquals(1, $DB->get_field('user', 'confirmed', array('id'=>2)));
|
||||
|
||||
@ -234,7 +234,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
|
||||
try {
|
||||
self::resetAllData(true);
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
|
||||
$this->assertContains('xx', $e->getMessage());
|
||||
$this->assertContains('admin', $e->getMessage());
|
||||
$this->assertContains('rolesactive', $e->getMessage());
|
||||
@ -276,7 +276,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
|
||||
try {
|
||||
self::resetAllData(true);
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
|
||||
$this->assertEquals(1, $SITE->id);
|
||||
$this->assertSame($SITE, $COURSE);
|
||||
$this->assertSame($SITE, $COURSE);
|
||||
@ -287,7 +287,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
|
||||
try {
|
||||
self::resetAllData(true);
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
|
||||
$this->assertEquals(0, $USER->id);
|
||||
}
|
||||
}
|
||||
@ -377,7 +377,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
|
||||
$this->assertTimeCurrent(time()+10);
|
||||
$this->fail('Failed assert expected');
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_ExpectationFailedException', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\ExpectationFailedException', $e);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -385,7 +385,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
|
||||
$this->assertTimeCurrent(time()-10);
|
||||
$this->fail('Failed assert expected');
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_ExpectationFailedException', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\ExpectationFailedException', $e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -600,19 +600,19 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
|
||||
try {
|
||||
$this->setTimezone('Pacific/Auckland', '');
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
|
||||
}
|
||||
|
||||
try {
|
||||
$this->setTimezone('Pacific/Auckland', 'xxxx');
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
|
||||
}
|
||||
|
||||
try {
|
||||
$this->setTimezone('Pacific/Auckland', null);
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -637,7 +637,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
|
||||
try {
|
||||
self::resetAllData(true);
|
||||
} catch (Exception $e) {
|
||||
$this->assertInstanceOf('PHPUnit_Framework_Error_Warning', $e);
|
||||
$this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e);
|
||||
}
|
||||
|
||||
if ($CFG->ostype === 'WINDOWS') {
|
||||
|
@ -851,7 +851,7 @@ class core_event_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_Error_Notice
|
||||
* @expectedException PHPUnit\Framework\Error\Notice
|
||||
*/
|
||||
public function test_context_not_used() {
|
||||
$event = \core_tests\event\context_used_in_event::create(array('other' => array('sample' => 1, 'xx' => 10)));
|
||||
|
@ -1824,7 +1824,7 @@ class core_moodlelib_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_Error_Warning
|
||||
* @expectedException PHPUnit\Framework\Error\Warning
|
||||
*/
|
||||
public function test_get_string_limitation() {
|
||||
// This is one of the limitations to the lang_string class. It can't be
|
||||
|
@ -188,16 +188,16 @@ class core_statslib_testcase extends advanced_testcase {
|
||||
static $replacements = null;
|
||||
|
||||
$raw = $this->createXMLDataSet($file);
|
||||
$clean = new PHPUnit_Extensions_Database_DataSet_ReplacementDataSet($raw);
|
||||
$clean = new PHPUnit\DbUnit\DataSet\ReplacementDataSet($raw);
|
||||
|
||||
foreach ($this->replacements as $placeholder => $value) {
|
||||
$clean->addFullReplacement($placeholder, $value);
|
||||
}
|
||||
|
||||
$logs = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($clean);
|
||||
$logs = new PHPUnit\DbUnit\DataSet\DataSetFilter($clean);
|
||||
$logs->addIncludeTables(array('log'));
|
||||
|
||||
$stats = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($clean);
|
||||
$stats = new PHPUnit\DbUnit\DataSet\DataSetFilter($clean);
|
||||
$stats->addIncludeTables(array('stats_daily', 'stats_user_daily'));
|
||||
|
||||
return array($logs, $stats);
|
||||
|
@ -53,7 +53,7 @@ class quiz_report_responses_from_steps_testcase extends mod_quiz_attempt_walkthr
|
||||
* Create a quiz add questions to it, walk through quiz attempts and then check results.
|
||||
*
|
||||
* @param array $quizsettings settings to override default settings for quiz created by generator. Taken from quizzes.csv.
|
||||
* @param PHPUnit_Extensions_Database_DataSet_ITable[] $csvdata of data read from csv file "questionsXX.csv",
|
||||
* @param PHPUnit\DbUnit\DataSet\ITable[] $csvdata of data read from csv file "questionsXX.csv",
|
||||
* "stepsXX.csv" and "responsesXX.csv".
|
||||
* @dataProvider get_data_for_walkthrough
|
||||
*/
|
||||
|
@ -66,7 +66,7 @@ class quiz_report_statistics_from_steps_testcase extends mod_quiz_attempt_walkth
|
||||
/**
|
||||
* Create a quiz add questions to it, walk through quiz attempts and then check results.
|
||||
*
|
||||
* @param PHPUnit_Extensions_Database_DataSet_ITable[] of data read from csv file "questionsXX.csv",
|
||||
* @param PHPUnit\DbUnit\DataSet\ITable[] of data read from csv file "questionsXX.csv",
|
||||
* "stepsXX.csv" and "resultsXX.csv".
|
||||
* @dataProvider get_data_for_walkthrough
|
||||
*/
|
||||
@ -89,7 +89,7 @@ class quiz_report_statistics_from_steps_testcase extends mod_quiz_attempt_walkth
|
||||
/**
|
||||
* Check actual question stats are the same as that found in csv file.
|
||||
*
|
||||
* @param $qstats PHPUnit_Extensions_Database_DataSet_ITable data from csv file.
|
||||
* @param $qstats PHPUnit\DbUnit\DataSet\ITable data from csv file.
|
||||
* @param $questionstats \core_question\statistics\questions\all_calculated_for_qubaid_condition Calculated stats.
|
||||
*/
|
||||
protected function check_question_stats($qstats, $questionstats) {
|
||||
@ -358,7 +358,7 @@ class quiz_report_statistics_from_steps_testcase extends mod_quiz_attempt_walkth
|
||||
/**
|
||||
* Check the question stats and the response counts used in the statistics report. If the appropriate files exist in fixtures/.
|
||||
*
|
||||
* @param PHPUnit_Extensions_Database_DataSet_ITable[] $csvdata Data loaded from csv files for this test.
|
||||
* @param PHPUnit\DbUnit\DataSet\ITable[] $csvdata Data loaded from csv files for this test.
|
||||
* @param string $whichattempts
|
||||
* @param string $whichtries
|
||||
* @param \core\dml\sql_join $groupstudentsjoins
|
||||
|
@ -57,7 +57,7 @@ class mod_quiz_attempt_walkthrough_from_csv_testcase extends advanced_testcase {
|
||||
* directory.
|
||||
*
|
||||
* @param array $quizsettings of settings read from csv file quizzes.csv
|
||||
* @param PHPUnit_Extensions_Database_DataSet_ITable[] $csvdata of data read from csv file "questionsXX.csv",
|
||||
* @param PHPUnit\DbUnit\DataSet\ITable[] $csvdata of data read from csv file "questionsXX.csv",
|
||||
* "stepsXX.csv" and "resultsXX.csv".
|
||||
* @dataProvider get_data_for_walkthrough
|
||||
*/
|
||||
@ -141,7 +141,7 @@ class mod_quiz_attempt_walkthrough_from_csv_testcase extends advanced_testcase {
|
||||
* Create quiz, simulate attempts and check results (if resultsXX.csv exists).
|
||||
*
|
||||
* @param array $quizsettings Quiz overrides for this quiz.
|
||||
* @param PHPUnit_Extensions_Database_DataSet_ITable[] $csvdata Data loaded from csv files for this test.
|
||||
* @param PHPUnit\DbUnit\DataSet\ITable[] $csvdata Data loaded from csv files for this test.
|
||||
*/
|
||||
protected function create_quiz_simulate_attempts_and_check_results($quizsettings, $csvdata) {
|
||||
$this->resetAfterTest(true);
|
||||
@ -172,7 +172,7 @@ class mod_quiz_attempt_walkthrough_from_csv_testcase extends advanced_testcase {
|
||||
*
|
||||
* @param string $setname
|
||||
* @param string $test
|
||||
* @return \PHPUnit_Extensions_Database_DataSet_ITable
|
||||
* @return PHPUnit\DbUnit\DataSet\ITable
|
||||
*/
|
||||
protected function load_csv_data_file($setname, $test='') {
|
||||
$files = array($setname => $this->get_full_path_of_csv_file($setname, $test));
|
||||
@ -228,7 +228,7 @@ class mod_quiz_attempt_walkthrough_from_csv_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $steps PHPUnit_Extensions_Database_DataSet_ITable the step data from the csv file.
|
||||
* @param $steps PHPUnit\DbUnit\DataSet\ITable the step data from the csv file.
|
||||
* @return array attempt no as in csv file => the id of the quiz_attempt as stored in the db.
|
||||
*/
|
||||
protected function walkthrough_attempts($steps) {
|
||||
@ -289,7 +289,7 @@ class mod_quiz_attempt_walkthrough_from_csv_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $results PHPUnit_Extensions_Database_DataSet_ITable the results data from the csv file.
|
||||
* @param $results PHPUnit\DbUnit\DataSet\ITable the results data from the csv file.
|
||||
* @param $attemptids array attempt no as in csv file => the id of the quiz_attempt as stored in the db.
|
||||
*/
|
||||
protected function check_attempts_results($results, $attemptids) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user