当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_TestSuite::testAt方法代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:30,代码来源:TestCasePropertiesTest.php

示例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 {
         }
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:49,代码来源:KalturaTestListener.php


注:本文中的PHPUnit_Framework_TestSuite::testAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。