本文整理汇总了PHP中PHPUnit_Util_Test::getDependencies方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Test::getDependencies方法的具体用法?PHP PHPUnit_Util_Test::getDependencies怎么用?PHP PHPUnit_Util_Test::getDependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_Test
的用法示例。
在下文中一共展示了PHPUnit_Util_Test::getDependencies方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @constructor
* @param string $class
* @param string $name
* @param string $path
*/
public function __construct($class = '', $name = '', $path = '')
{
$this->initObjectManager();
if (!$class || !class_exists($class, false)) {
$this->addTest(self::warning(sprintf('Test Case Class is not valid or empty: "%s"', $class)));
return;
}
if (!$name) {
$this->addTest(self::warning(sprintf('Test Method Should be set for InjectableMethod class. Test Case Class: %s', $class)));
return;
}
$this->setName($name);
$arguments = ['class' => $class, 'path' => $path, 'name' => $name];
$theClass = new \ReflectionClass($class);
$method = $theClass->getMethod($name);
if (!$this->isPublicTestMethod($method)) {
return;
}
$methodName = $method->getName();
$test = self::createTest($theClass, $methodName, $arguments);
if ($test instanceof \PHPUnit_Framework_TestCase || $test instanceof InjectableMethod) {
$test->setDependencies(\PHPUnit_Util_Test::getDependencies($class, $methodName));
}
$this->addTest($test, \PHPUnit_Util_Test::getGroups($class, $methodName));
$this->testCase = true;
}
示例2: enhancePhpunitTest
protected function enhancePhpunitTest(\PHPUnit_Framework_TestCase $test)
{
$className = get_class($test);
$methodName = $test->getName(false);
$dependencies = \PHPUnit_Util_Test::getDependencies($className, $methodName);
$test->setDependencies($dependencies);
if ($test instanceof TestCaseFormat) {
$test->getMetadata()->setDependencies($dependencies);
$test->getMetadata()->setEnv(Annotation::forMethod($test, $methodName)->fetchAll('env'));
}
}
示例3: enhancePhpunitTest
protected function enhancePhpunitTest(\PHPUnit_Framework_TestCase $test)
{
$className = get_class($test);
$methodName = $test->getName(false);
$dependencies = \PHPUnit_Util_Test::getDependencies($className, $methodName);
$test->setDependencies($dependencies);
if ($test instanceof UnitFormat) {
$feature = $test->getName();
$feature = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\\1 \\2', $feature);
$feature = preg_replace('/([a-z\\d])([A-Z])/', '\\1 \\2', $feature);
$test->getMetadata()->setFeature(strtolower($feature));
$test->getMetadata()->setDependencies($dependencies);
$test->getMetadata()->setEnv(Annotation::forMethod($test, $methodName)->fetchAll('env'));
}
}
示例4: addTestMethod
/**
* @param ReflectionClass $class
* @param ReflectionMethod $method
*/
protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method)
{
if (!$this->isTestMethod($method)) {
return;
}
$name = $method->getName();
if (!$method->isPublic()) {
$this->addTest(self::warning(sprintf('Test method "%s" in test class "%s" is not public.', $name, $class->getName())));
return;
}
$test = self::createTest($class, $name);
if ($test instanceof PHPUnit_Framework_TestCase || $test instanceof PHPUnit_Framework_TestSuite_DataProvider) {
$test->setDependencies(PHPUnit_Util_Test::getDependencies($class->getName(), $name));
}
$this->addTest($test, PHPUnit_Util_Test::getGroups($class->getName(), $name));
}
示例5: testParseAnnotationThatIsOnlyOneLine
public function testParseAnnotationThatIsOnlyOneLine()
{
$this->assertEquals(array('Bar'), PHPUnit_Util_Test::getDependencies(get_class($this), 'methodForTestParseAnnotationThatIsOnlyOneLine'));
}
示例6: createTestFromCestMethod
protected function createTestFromCestMethod($cestInstance, $methodName, $file)
{
if (strpos($methodName, '_') === 0 or $methodName == '__construct') {
return null;
}
$testClass = get_class($cestInstance);
$cest = new Cest();
$cest->configName($methodName)->configFile($file)->config('testClassInstance', $cestInstance)->config('testMethod', $methodName)->initConfig();
$cest->getScenario()->env(Annotation::forMethod($testClass, $methodName)->fetchAll('env'));
$cest->setDependencies(\PHPUnit_Util_Test::getDependencies($testClass, $methodName));
return $cest;
}
示例7: testParseAnnotation
public function testParseAnnotation()
{
$this->assertEquals(array('Foo', 'ほげ'), PHPUnit_Util_Test::getDependencies(get_class($this), 'methodForTestParseAnnotation'));
}
示例8: addTestDependencies
/**
* Takes a test and adds its dependencies
*
* @param PHPUnit_Framework_Test $test Object. A Test can be run and collect its results
* @param string $className Name of class what loaded to parsing and execute
* @param string $methodName Name of method what loaded from class to adding dependencies
*
* @return void
*/
public static function addTestDependencies(PHPUnit_Framework_Test $test, $className, $methodName)
{
if ($test instanceof PHPUnit_Framework_TestCase || $test instanceof PHPUnit_Framework_TestSuite_DataProvider) {
$test->setDependencies(PHPUnit_Util_Test::getDependencies($className, $methodName));
}
return $test;
}
示例9: createTestFromCestMethod
protected function createTestFromCestMethod($cestInstance, $methodName, $file)
{
if (strpos($methodName, '_') === 0 || $methodName == '__construct') {
return null;
}
$testClass = get_class($cestInstance);
$cest = new Cest();
$cest->configName($methodName)->configFile($file)->config('testClassInstance', $cestInstance)->config('testMethod', $methodName);
$cest->setDependencies(\PHPUnit_Util_Test::getDependencies($testClass, $methodName));
return $cest;
}
示例10: createTestFromCestMethod
protected function createTestFromCestMethod($cestInstance, $methodName, $file)
{
$testClass = get_class($cestInstance);
if (strpos($methodName, '_') === 0) {
return;
}
$guy = $this->settings['namespace'] ? $this->settings['namespace'] . '\\Codeception\\' . $this->settings['class_name'] : $this->settings['class_name'];
$target = $testClass . '::' . $methodName;
$cest = new TestCase\Cest($this->dispatcher, array('name' => $target, 'instance' => $cestInstance, 'method' => $methodName, 'file' => $file, 'bootstrap' => $this->settings['bootstrap'], 'guy' => $guy));
$cest->setDependencies(\PHPUnit_Util_Test::getDependencies($testClass, $methodName));
$cest->preload();
return $cest;
}
示例11: addGeneratedTestTo
private static function addGeneratedTestTo(PHPUnit_Framework_TestSuite $suite, PHPUnit_Framework_TestCase $test, $classGroups)
{
list($methodName, ) = explode(' ', $test->getName());
$test->setDependencies(PHPUnit_Util_Test::getDependencies(get_class($test), $methodName));
$suite->addTest($test, $classGroups);
}
示例12: createTestFromCestMethod
protected function createTestFromCestMethod($cestInstance, $methodName, $file, $guy)
{
$testClass = get_class($cestInstance);
if (strpos($methodName, '_') === 0) {
return;
}
$overriddenGuy = Annotation::forMethod($testClass, $methodName)->fetch('guy');
if (!$overriddenGuy) {
$overriddenGuy = Annotation::forClass($testClass)->fetch('guy');
}
if ($overriddenGuy) {
$guy = $overriddenGuy;
}
$cest = new TestCase\Cest($this->dispatcher, array('name' => $methodName, 'instance' => $cestInstance, 'method' => $methodName, 'file' => $file, 'bootstrap' => $this->settings['bootstrap'], 'guy' => $guy));
$cest->getScenario()->env(Annotation::forMethod($testClass, $methodName)->fetchAll('env'));
$cest->getScenario()->groups(\PHPUnit_Util_Test::getGroups($testClass, $methodName));
$cest->setDependencies(\PHPUnit_Util_Test::getDependencies($testClass, $methodName));
$cest->preload();
return $cest;
}