本文整理汇总了PHP中PHPUnit_Framework_TestSuite::testAt方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestSuite::testAt方法的具体用法?PHP PHPUnit_Framework_TestSuite::testAt怎么用?PHP PHPUnit_Framework_TestSuite::testAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_TestSuite
的用法示例。
在下文中一共展示了PHPUnit_Framework_TestSuite::testAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testEndTestSuiteDestruct
public function testEndTestSuiteDestruct()
{
$phpUnitTestSuite = new \PHPUnit_Framework_TestSuite();
$phpUnitTestSuite->addTestFile(__DIR__ . '/TestCasePropertiesTest/DummyTestCase.php');
// Because addTestFile() adds classes from file to tests array, use first testsuite
/** @var $testSuite \PHPUnit_Framework_TestSuite */
$testSuite = $phpUnitTestSuite->testAt(0);
$testSuite->run();
/** @var $testClass \Magento\Test\Workaround\Cleanup\TestCasePropertiesTest\DummyTestCase */
$testClass = $testSuite->testAt(0);
$propertyObjectMock = $this->getMock('stdClass', ['__destruct']);
$propertyObjectMock->expects($this->atLeastOnce())->method('__destruct');
$testClass->setPropertyObject($propertyObjectMock);
foreach ($this->_fixtureProperties as $property) {
if ($property['is_static']) {
$this->assertAttributeNotEmpty($property['name'], get_class($testClass));
} else {
$this->assertAttributeNotEmpty($property['name'], $testClass);
}
}
$clearProperties = new \Magento\TestFramework\Workaround\Cleanup\TestCaseProperties();
$clearProperties->endTestSuite($testSuite);
foreach ($this->_fixtureProperties as $property) {
if ($property['is_static']) {
$this->assertAttributeEmpty($property['name'], get_class($testClass));
} else {
$this->assertAttributeEmpty($property['name'], $testClass);
}
}
}
示例2: startTestSuite
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
{
// print("In startTestSuite - for suite = {$suite->getName()}\n");
KalturaLog::debug("In startTestSuite - for suite = {$suite->getName()}");
if ($suite instanceof PHPUnit_Framework_TestSuite_DataProvider) {
//Get the test procedure name from the suite name which is (testCase::testProcedure)
$testNames = explode("::", $suite->getName());
$testName = $testNames[0];
if (isset($testNames[1])) {
$testName = $testNames[1];
}
$testCase = $testNames[0];
if (is_null(KalturaTestListener::$testCaseFailures)) {
KalturaLog::debug("KalturaTestCaseFailures is null creating empty test case failures for {$testCase}\n");
KalturaTestListener::$testCaseFailures = new KalturaTestCaseFailures($testName);
}
$testProcedure = KalturaTestListener::$testCaseFailures->getTestProcedureFailure($testName);
//if the test procedure exists
if (!$testProcedure) {
KalturaTestListener::$testCaseFailures->addTestProcedureFailure(new KalturaTestProcedureFailure($testName));
} else {
KalturaLog::alert("Test procedure [{$testName}] already added");
}
} else {
//Check if the test belongs to the same test case failures (by the first test of the suite)
$test = $suite->testAt(0);
if ($test instanceof PHPUnit_Framework_TestSuite_DataProvider) {
$test = $test->testAt(0);
}
$class = get_class($test);
//if the new test comes from a new file (testCase)
if (KalturaTestListener::$currentTestCase != $class) {
//Gets the class path for the failure file
$classPath = KAutoloader::getClassFilePath($class);
KalturaTestListener::$failureFilePath = dirname($classPath) . "/testsData/{$class}.failures";
KalturaTestListener::$dataFilePath = dirname($classPath) . "/testsData/{$class}.data";
$this->writeFailuresToFile();
//Opens the new failure file for the new test
KalturaTestListener::$failuresFile = fopen(KalturaTestListener::$failureFilePath, "w+");
//Change the current test case
KalturaTestListener::$currentTestCase = $class;
//Create new test case failures for the new test case
KalturaTestListener::$testCaseFailures = new KalturaTestCaseFailures(KalturaTestListener::$currentTestCase);
//TODO: get the test procedure name from the suite
KalturaTestListener::$testCaseFailures->setTestProceduresFailures(array(new KalturaTestProcedureFailure("Unknown")));
} else {
}
}
}