本文整理汇总了PHP中codecept_root_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP codecept_root_dir函数的具体用法?PHP codecept_root_dir怎么用?PHP codecept_root_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了codecept_root_dir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doRequest
/**
* @param Request $request
*
* @return Response
* @throws \Exception
*/
public function doRequest($request)
{
$inputStream = fopen('php://memory', 'r+');
$content = $request->getContent();
if ($content !== null) {
fwrite($inputStream, $content);
rewind($inputStream);
}
$queryParams = [];
$postParams = [];
$queryString = parse_url($request->getUri(), PHP_URL_QUERY);
if ($queryString != '') {
parse_str($queryString, $queryParams);
}
if ($request->getMethod() !== 'GET') {
$postParams = $request->getParameters();
}
$serverParams = $request->getServer();
if (!isset($serverParams['SCRIPT_NAME'])) {
//required by WhoopsErrorHandler
$serverParams['SCRIPT_NAME'] = 'Codeception';
}
$zendRequest = new ServerRequest($serverParams, $this->convertFiles($request->getFiles()), $request->getUri(), $request->getMethod(), $inputStream, $this->extractHeaders($request));
$zendRequest = $zendRequest->withCookieParams($request->getCookies())->withQueryParams($queryParams)->withParsedBody($postParams);
$cwd = getcwd();
chdir(codecept_root_dir());
$this->application->run($zendRequest);
chdir($cwd);
$this->request = $zendRequest;
$response = $this->responseCollector->getResponse();
$this->responseCollector->clearResponse();
return new Response($response->getBody(), $response->getStatusCode(), $response->getHeaders());
}
示例2: makeTestCase
protected function makeTestCase($file, $name = '')
{
return Stub::make('\Codeception\Lib\DescriptiveTestCase', [
'getReportFields' => ['file' => codecept_root_dir() . $file],
'getName' => $name]
);
}
示例3: testShortcutFilter
public function testShortcutFilter()
{
$config = ['coverage' => ['include' => ['tests/*'], 'exclude' => ['tests/unit/CodeGuy.php']]];
$this->filter->whiteList($config);
$fileFilter = $this->filter->getFilter();
$this->assertFalse($fileFilter->isFiltered(codecept_root_dir('tests/unit/c3Test.php')));
$this->assertTrue($fileFilter->isFiltered(codecept_root_dir('tests/unit/CodeGuy.php')));
}
示例4: getDrupalRoot
/**
* Get the Drupal root directory.
*
* @return string
* The root directory of the Drupal installation.
*/
private function getDrupalRoot()
{
// We can't get getcwd() as a default parameter, so this will have to do.
if (is_null($this->config['drupalRoot'])) {
return codecept_root_dir();
} else {
// If a user has passed in a path to their Drupal root, then we'll still need to append the current working
// directory to it.
return codecept_root_dir($this->config['drupalRoot']);
}
}
示例5: testOneFileWithHtml
public function testOneFileWithHtml()
{
$this->config['path'] = 'tests/data/claypit/tests/skipped/';
$this->config['class_name'] = 'SkipGuy';
$this->execute(array('suite' => 'skipped', '--single-file' => true, '--format' => 'html'));
$this->assertEquals(codecept_root_dir() . 'tests/data/scenarios/skipped.html', $this->filename);
$this->assertContains('<h3>I WANT TO MAKE IT INCOMPLETE</h3>', $this->content);
$this->assertContains('<h3>I WANT TO SKIP IT</h3>', $this->content);
$this->assertContains('<body><h3>', $this->content);
$this->assertContains('</body></html>', $this->content);
$this->assertContains('* Skip_Me rendered', $this->output);
$this->assertContains('* Incomplete_Me rendered', $this->output);
}
示例6: getDrupalRoot
/**
* Get the Drupal root directory.
*
* @return string
* The root directory of the Drupal installation.
*/
public function getDrupalRoot()
{
// We can't get getcwd() as a default parameter, so this will have to do.
if (is_null($this->config['root'])) {
return codecept_root_dir();
}
// Allow a user to pass an relative or an absolute path.
if (is_null($this->config['relative']) || $this->config['relative'] !== 'yes') {
return $this->config['root'];
} else {
return codecept_root_dir($this->config['root']);
}
}
示例7: _afterSuite
/**
* Called after suite.
*
* Fail the suite and output changes, if any differences was detected.
*/
public function _afterSuite()
{
// Filter out files that's disappeared. This allows for processing
// the files before we've finished the test run.
$changes = array_filter($this->changes, function ($file) {
return file_exists($file . self::NEWSUFFIX);
});
if (!empty($changes)) {
$fileLines = array_map(function ($file) {
$short_name = preg_replace('/^' . preg_quote(codecept_root_dir(), '/') . '/', '', $file);
if (file_exists($file . self::SUFFIX)) {
return "Changed: " . $short_name . self::NEWSUFFIX;
}
return "New: " . $short_name . self::NEWSUFFIX;
}, $changes);
$message = "Visual changes detected:\n";
$message .= implode("\n", $fileLines);
$this->fail($message);
}
}
示例8: _before
protected function _before()
{
$this->tarotDeck = new TarotDeck('custom', [codecept_root_dir() . 'resources/']);
$this->tarotDraw = new TarotDraw($this->tarotDeck);
}
示例9: codecept_root_dir
<?php
/**
* @file Global bootstrap for all codeception tests
*/
Codeception\Util\Autoload::addNamespace('Tribe__Events__WP_UnitTestCase', __DIR__ . '/_support');
Codeception\Util\Autoload::addNamespace('Tribe\\Events\\Test', __DIR__ . '/_support');
require_once codecept_root_dir('tribe-autoload.php');
示例10: getRootFolder
/**
* @return string
*/
protected function getRootFolder()
{
return isset($this->config['rootFolder']) ? $this->config['rootFolder'] : rtrim(codecept_root_dir(), DIRECTORY_SEPARATOR);
}
示例11: _initialize
public function _initialize()
{
if (!is_file(codecept_root_dir() . $this->config['configFile'])) {
throw new ModuleConfigException(__CLASS__, "The application config file does not exist: " . codecept_root_dir() . $this->config['configFile']);
}
$this->defineConstants();
}
示例12: getLocalConfigFilePath
public function getLocalConfigFilePath()
{
return codecept_root_dir('commands-config.yml');
}
示例13: codecept_relative_path
function codecept_relative_path($path)
{
return substr($path, strlen(codecept_root_dir()));
}
示例14: _beforeSuite
public function _beforeSuite($settings = [])
{
$store = null;
if ($this->ormModule instanceof DataMapper) {
// for Doctrine
$store = new RepositoryStore($this->ormModule->_getEntityManager());
}
$this->factoryMuffin = new FactoryMuffin($store);
if ($this->config['factories']) {
foreach ((array) $this->config['factories'] as $factoryPath) {
$realpath = realpath(codecept_root_dir() . $factoryPath);
if ($realpath === false) {
throw new ModuleException($this, 'The path to one of your factories is not correct. Please specify the directory relative to the codeception.yml file (ie. _support/factories).');
}
$this->factoryMuffin->loadFactories($realpath);
}
}
}
示例15: getSetupFilePath
/**
* @param InputInterface $input
* @return mixed|string
*/
protected function getSetupFilePath(InputInterface $input)
{
$destination = $input->getOption('destination');
$file = $destination ? $destination : codecept_root_dir('setup.yml');
return $file;
}