本文整理汇总了PHP中Codeception\Configuration::logDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::logDir方法的具体用法?PHP Configuration::logDir怎么用?PHP Configuration::logDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Codeception\Configuration
的用法示例。
在下文中一共展示了Configuration::logDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->config = Configuration::config();
$this->log_dir = Configuration::logDir();
// prepare log dir
parent::__construct();
}
示例2: _failed
public function _failed(\Codeception\TestCase $test, $fail)
{
if (!$this->client || !$this->client->getInternalResponse()) {
return;
}
file_put_contents(\Codeception\Configuration::logDir() . basename($test->getFileName()) . '.page.debug.html', $this->client->getInternalResponse()->getContent());
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$conf = $this->getGlobalConfig($input->getOption('config'));
$output->writeln("<info>Cleaning up " . Configuration::logDir() . "...</info>");
FileSystem::doEmptyDir(Configuration::logDir());
$output->writeln("Done");
}
示例4: __construct
public function __construct()
{
$this->config = Configuration::config();
$this->log_dir = Configuration::logDir();
// prepare log dir
$this->phpUnitOverriders();
parent::__construct();
}
示例5: __construct
public function __construct($max_files = 3)
{
$this->path = \Codeception\Configuration::logDir();
$this->max_files = $max_files;
// internal log
$logHandler = new \Monolog\Handler\RotatingFileHandler($this->path . 'codeception.log', $this->max_files);
$this->logger = new \Monolog\Logger('Codeception');
$this->logger->pushHandler($logHandler);
}
示例6: generateFilename
public function generateFilename(CodeGuy $I)
{
$I->haveFakeClass($stub = Stub::make($this->class, array('test' => Stub::makeEmpty('\\Codeception\\TestCase\\Cept', array('getFileName' => function () {
return 'testtest';
})))));
$I->executeTestedMethod($stub);
$I->seeResultEquals(\Codeception\Configuration::logDir() . 'debug' . DIRECTORY_SEPARATOR . 'testtest - 1');
$I->executeTestedMethod($stub, 'mytest');
$I->seeResultEquals(\Codeception\Configuration::logDir() . 'debug' . DIRECTORY_SEPARATOR . 'testtest - 2 - mytest');
}
示例7: __construct
/**
* Class constructor.
*
* @param array $config
* @param array $options
* @param PhireMockProcess $process optional PhiremockProcess object
*/
public function __construct(array $config, array $options, PhiremockProcess $process = null)
{
$this->config['bin_path'] = Config::projectDir() . '../vendor/bin/phiremock';
$this->config['logs_path'] = Config::logDir();
parent::__construct($config, $options);
$this->initProcess($process);
list($ip, $port) = explode(':', $this->config['listen']);
$this->process->start($ip, $port, $this->config['bin_path'], $this->config['logs_path'], $this->config['debug']);
if ($this->config['startDelay']) {
sleep($this->config['startDelay']);
}
}
示例8: _initialize
public function _initialize()
{
$this->debug('Initializing PuffinReport');
if (array_key_exists('logFile', $this->config)) {
$this->logFile = $this->config['logFile'];
} else {
$this->logFile = Configuration::logDir() . 'vcresult.html';
}
if (array_key_exists('templateVars', $this->config)) {
$this->templateVars = $this->config['templateVars'];
}
if (array_key_exists('templateFile', $this->config)) {
$this->templateFile = $this->config['templateFile'];
} else {
$this->templateFile = __DIR__ . '/report/template.php';
}
}
示例9: init
private function init()
{
$this->debug("Initializing VisualCeptionReport");
if (array_key_exists('logFile', $this->config)) {
$this->logFile = $this->config["logFile"];
} else {
$this->logFile = \Codeception\Configuration::logDir() . 'vcresult.html';
}
if (array_key_exists('templateVars', $this->config)) {
$this->templateVars = $this->config["templateVars"];
}
if (array_key_exists('templateFile', $this->config)) {
$this->templateFile = $this->config["templateFile"];
} else {
$this->templateFile = __DIR__ . "/report/template.php";
}
}
示例10: startServer
private function startServer()
{
if ($this->resource !== null) {
return;
}
$command = $this->getCommand();
$descriptorSpec = [['pipe', 'r'], ['file', Configuration::logDir() . 'phpbuiltinserver.output.txt', 'w'], ['file', Configuration::logDir() . 'phpbuiltinserver.errors.txt', 'a']];
$this->resource = proc_open($command, $descriptorSpec, $this->pipes, null, null, ['bypass_shell' => true]);
if (!is_resource($this->resource)) {
throw new ExtensionException($this, 'Failed to start server.');
}
if (!proc_get_status($this->resource)['running']) {
proc_close($this->resource);
throw new ExtensionException($this, 'Failed to start server.');
}
if ($this->config['startDelay'] > 0) {
sleep($this->config['startDelay']);
}
}
示例11: startServer
private function startServer()
{
if ($this->resource !== null) {
return;
}
$command = $this->getCommand();
$descriptorSpec = [['pipe', 'r'], ['file', Configuration::logDir() . 'phpbuiltinserver.output.txt', 'w'], ['file', Configuration::logDir() . 'phpbuiltinserver.errors.txt', 'a']];
$this->resource = proc_open($command, $descriptorSpec, $this->pipes, null, null, ['bypass_shell' => true]);
if (!is_resource($this->resource)) {
throw new ExtensionException($this, 'Failed to start server.');
}
if (!proc_get_status($this->resource)['running']) {
proc_close($this->resource);
throw new ExtensionException($this, 'Failed to start server.');
}
$max_checks = 10;
$checks = 0;
$this->write("Waiting for the PHP server to be reachable");
while (true) {
if ($checks >= $max_checks) {
throw new ExtensionException($this, 'PHP server never became reachable');
break;
}
if ($fp = @fsockopen($this->config['hostname'], $this->config['port'], $errCode, $errStr, 10)) {
$this->writeln('');
$this->writeln("PHP server is now reachable");
fclose($fp);
break;
}
$this->write('.');
$checks++;
// Wait before checking again
sleep(1);
}
// Clear progress line writing
$this->writeln('');
}
示例12: __construct
/**
* Class constructor.
*/
public function __construct()
{
$this->defaults['logs-path'] = Config::logDir();
}
示例13: makeScreenshot
/**
* Makes a screenshot of current window and saves it to `tests/_log/debug`.
*
* ``` php
* <?php
* $I->amOnPage('/user/edit');
* $I->makeScreenshot('edit page');
* // saved to: tests/_log/debug/UserEdit - edit page.png
* ?>
* ```
*
* @param $name
*/
public function makeScreenshot($name)
{
$debugDir = \Codeception\Configuration::logDir() . 'debug';
if (!is_dir($debugDir)) {
mkdir($debugDir, 0777);
}
$caseName = str_replace('Cept.php', '', $this->test->getFileName());
$caseName = str_replace('Cept.php', '', $caseName);
/**
* This is used for Cept only
*
* To be consistent with Cest, no sub-dir would be created, '\' and '/' in $caseName would be replaced with '.'
*/
$search = array('/', '\\');
$replace = array('.', '.');
$caseName = str_replace($search, $replace, $caseName);
$screenName = $debugDir . DIRECTORY_SEPARATOR . $caseName . ' - ' . $name . '.png';
$this->_saveScreenshot($screenName);
$this->debug("Screenshot saved to {$screenName}");
}
示例14: fopen
<?php
require_once __DIR__ . '/_data/MyOutputFormatter.php';
require_once __DIR__ . '/_data/MyGroupHighlighter.php';
@unlink(\Codeception\Configuration::logDir() . 'order.txt');
$fh = fopen(\Codeception\Configuration::logDir() . 'order.txt', 'a');
fwrite($fh, 'B');
示例15: _failed
public function _failed(\Codeception\TestCase $test, $fail)
{
$output = \Codeception\Configuration::logDir() . DIRECTORY_SEPARATOR . basename($test->getFileName()) . '.page.debug.html';
file_put_contents($output, $this->browser->getResponse()->getContent());
}