本文整理汇总了PHP中Codeception\Util\Debug类的典型用法代码示例。如果您正苦于以下问题:PHP Debug类的具体用法?PHP Debug怎么用?PHP Debug使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Debug类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: canObtainAllPaths
/**
* @test
*
* @covers ::all
*/
public function canObtainAllPaths()
{
$paths = $this->makeFilesPaths(rand(3, 10));
$collection = $this->makeFilesCollection($paths);
Debug::debug($collection);
$this->assertSame($paths, $collection->all());
}
开发者ID:aedart,项目名称:scaffold,代码行数:12,代码来源:FilesTest.php
示例2: doRequest
/**
*
* @param \Symfony\Component\BrowserKit\Request $request
*
* @return \Symfony\Component\BrowserKit\Response
*/
public function doRequest($request)
{
$_COOKIE = $request->getCookies();
$_SERVER = $request->getServer();
$_FILES = $request->getFiles();
$_REQUEST = $request->getParameters();
$_POST = $_GET = array();
if (strtoupper($request->getMethod()) == 'GET') {
$_GET = $request->getParameters();
} else {
$_POST = $request->getParameters();
}
$uri = $request->getUri();
$pathString = parse_url($uri, PHP_URL_PATH);
$queryString = parse_url($uri, PHP_URL_QUERY);
$_SERVER['REQUEST_URI'] = $queryString === null ? $pathString : $pathString . '?' . $queryString;
$_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod());
parse_str($queryString, $params);
foreach ($params as $k => $v) {
$_GET[$k] = $v;
}
$app = $this->startApp();
$app->getResponse()->on(YiiResponse::EVENT_AFTER_PREPARE, array($this, 'processResponse'));
$this->headers = array();
$this->statusCode = null;
ob_start();
$app->handleRequest($app->getRequest())->send();
$content = ob_get_clean();
// catch "location" header and display it in debug, otherwise it would be handled
// by symfony browser-kit and not displayed.
if (isset($this->headers['location'])) {
Debug::debug("[Headers] " . json_encode($this->headers));
}
return new Response($content, $this->statusCode, $this->headers);
}
开发者ID:gargallo,项目名称:tfs-test,代码行数:41,代码来源:Yii2.php
示例3: testValidatorBase
public function testValidatorBase()
{
$validator = new Validator(__DIR__ . '/../_data/');
$report = $validator->validate(["shopId" => 1, "serviceType" => "2", "order" => ["number" => "VAL0001", "date" => "2014-03-01"], "from" => ["name" => "YuTIn", "address" => "Taiwan, Taipei", "phone" => "0963066000"], "to" => ["name" => "YuTIn", "address" => "Taiwan, Taipei", "phone" => "0963066000"]], 'schema');
Debug::debug($validator->getMessage());
$this->assertTrue($report);
}
开发者ID:yutin1987,项目名称:phalpro,代码行数:7,代码来源:ValidatorTest.php
示例4: createOutputPath
/**
* Creates an output path, if it does not already exist
*/
public function createOutputPath()
{
if (!file_exists($this->outputPath())) {
mkdir($this->outputPath(), 0755, true);
Debug::debug(sprintf('<info>Created output path </info><debug>%s</debug>', $this->outputPath()));
}
}
开发者ID:aedart,项目名称:scaffold,代码行数:10,代码来源:OutputPath.php
示例5: listEntities
private function listEntities($entityType)
{
Debug::debug("List {$entityType}");
$response = $this->sendRequest("{$entityType}", null, 'GET');
PHPUnit_Framework_Assert::assertGreaterThan(0, count($response->data));
return $response;
}
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:7,代码来源:APICest.php
示例6: thumbnail
public function thumbnail($pathToImage, $width, $height)
{
try {
$this->openImage = $this->imagine->open(FileHelper::normalizePath($pathToImage))->thumbnail(new \Imagine\Image\Box($width, $height));
} catch (\Exception $ex) {
\Codeception\Util\Debug::debug($ex->getMessage());
}
}
开发者ID:black-lamp,项目名称:yii2-imagable,代码行数:8,代码来源:CreateImageImagine.php
示例7: __construct
public function __construct($options)
{
$this->debug = $options['debug'] || $options['verbosity'] >= OutputInterface::VERBOSITY_VERY_VERBOSE;
$this->steps = $this->debug || $options['steps'];
$this->output = new Output($options);
if ($this->debug) {
Debug::setOutput($this->output);
}
}
开发者ID:lenninsanchez,项目名称:donadores,代码行数:9,代码来源:Console.php
示例8: debugCrud
/**
* Debug CRUD event result
* @param \dlds\giixer\components\events\GxCrudEvent $e
* @throws \yii\db\Exception
*/
public function debugCrud(\dlds\giixer\components\events\GxCrudEvent $e)
{
if (!$e->model) {
throw new \yii\db\Exception('Crud errors debug failed.');
}
\Codeception\Util\Debug::debug('Input:');
\Codeception\Util\Debug::debug($e->input);
\Codeception\Util\Debug::debug('Errors:');
\Codeception\Util\Debug::debug($e->model->getErrors());
}
开发者ID:dlds,项目名称:yii2-giixer,代码行数:15,代码来源:GxUnitTesterActions.php
示例9: log
public function log($message, $level, $category = 'application')
{
if (!in_array($level, [\yii\log\Logger::LEVEL_INFO, \yii\log\Logger::LEVEL_WARNING, \yii\log\Logger::LEVEL_ERROR])) {
return;
}
if (strpos($category, 'yii\\db\\Command') === 0) {
return;
// don't log queries
}
Debug::debug("[{$category}] {$message} ");
}
开发者ID:solutionDrive,项目名称:Codeception,代码行数:11,代码来源:Logger.php
示例10: testSchemaValidity
public function testSchemaValidity()
{
$em = \Codeception\Module\Doctrine2::$em;
$schema = new \Doctrine\ORM\Tools\SchemaValidator($em);
$errors = $schema->validateMapping();
$valid = count($errors) == 0;
if (!$valid) {
\Codeception\Util\Debug::debug($errors);
}
$this->assertEquals(true, $valid);
}
开发者ID:facilis,项目名称:users,代码行数:11,代码来源:SchemaValidationTest.php
示例11: _testToAbsUrl
protected function _testToAbsUrl($d, $base)
{
$path = '';
$port = '';
extract(parse_url($base));
$root = (@$scheme ? $scheme . ':' : '') . '//' . $host . (@$port ? ':' . $port : '');
//remove non-directory (file) part from the end of $path
$path = preg_replace('@/([^/]*\\.)+[^/]*$@', '', $path);
$clearBase = $root . $path;
Debug::debug("\nTesting NLSDownloader::toAbsUrl() with base\nbase={$base}");
Debug::debug('root=' . $root);
Debug::debug('clearBase=' . $clearBase);
Debug::debug(parse_url($base));
//Absolute urls
$rel = 'http://google.com';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals($rel, $abs, 'Absolute URL mapped to itself');
//Protocol-relative urls
$rel = '//google.com/somefile.txt';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals($scheme . ':' . $rel, $abs);
//Queries
$rel = '?x=1&y=2#somefragment';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals($clearBase . $rel, $abs);
//Fragments
$rel = '#somefragment';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals($clearBase . $rel, $abs);
//Root-relative urls
$rel = '/somepath2';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals($root . $rel, $abs);
$rel = '/somepath2/a/';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals($root . $rel, $abs);
$rel = '/somepath2/a.txt';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals($root . $rel, $abs);
//Relative urls
$rel = 'somepath2';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals(rtrim($clearBase, '/') . '/' . $rel, $abs);
$rel = 'somepath2/a/./../a';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals(rtrim($clearBase, '/') . '/somepath2/a', $abs);
if (preg_match('@\\.css$@', $base)) {
$rel = '../img/bg.png';
$abs = $d->toAbsUrl($rel, $base);
$this->assertEquals($root . '/img/bg.png', $abs);
}
}
开发者ID:nlac,项目名称:nlsclientscript,代码行数:52,代码来源:NLSDowloaderTest.php
示例12: doRequest
/**
*
* @param \Symfony\Component\BrowserKit\Request $request
*
* @return \Symfony\Component\BrowserKit\Response
*/
public function doRequest($request)
{
$_COOKIE = $request->getCookies();
$_SERVER = $request->getServer();
$_FILES = $this->remapFiles($request->getFiles());
$_REQUEST = $this->remapRequestParameters($request->getParameters());
$_POST = $_GET = array();
if (strtoupper($request->getMethod()) == 'GET') {
$_GET = $_REQUEST;
} else {
$_POST = $_REQUEST;
}
$uri = $request->getUri();
$pathString = parse_url($uri, PHP_URL_PATH);
$queryString = parse_url($uri, PHP_URL_QUERY);
$_SERVER['REQUEST_URI'] = $queryString === null ? $pathString : $pathString . '?' . $queryString;
$_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod());
parse_str($queryString, $params);
foreach ($params as $k => $v) {
$_GET[$k] = $v;
}
$app = $this->startApp();
$app->getResponse()->on(YiiResponse::EVENT_AFTER_PREPARE, array($this, 'processResponse'));
$this->headers = array();
$this->statusCode = null;
ob_start();
$yiiRequest = $app->getRequest();
$yiiRequest->setRawBody($request->getContent());
try {
$app->handleRequest($yiiRequest)->send();
} catch (\Exception $e) {
if ($e instanceof HttpException) {
// we shouldn't discard existing output as PHPUnit preform output level verification since PHPUnit 4.2.
$app->errorHandler->discardExistingOutput = false;
$app->errorHandler->handleException($e);
} elseif ($e instanceof ExitException) {
// nothing to do
} else {
// for exceptions not related to Http, we pass them to Codeception
throw $e;
}
}
$content = ob_get_clean();
// catch "location" header and display it in debug, otherwise it would be handled
// by symfony browser-kit and not displayed.
if (isset($this->headers['location'])) {
Debug::debug("[Headers] " . json_encode($this->headers));
}
return new Response($content, $this->statusCode, $this->headers);
}
开发者ID:kansey,项目名称:yii2albom,代码行数:56,代码来源:Yii2.php
示例13: testSetLanguageUrl
public function testSetLanguageUrl()
{
$app = \Yii::$app;
/** @var \bl\locale\UrlManager $urlManager */
$urlManager = clone $app->urlManager;
\Codeception\Util\Debug::debug("Before parse request app language: {$app->language}");
$urlManager->detectInCookie = false;
$urlManager->detectInSession = false;
$language = 'uk-UA';
$url = "{$language}/site/index";
$request = $app->request;
$request->setPathInfo($url);
$parse = $urlManager->parseRequest($request);
\Codeception\Util\Debug::debug("After parse request app language: {$app->language}");
$this->tester->assertEquals($language, \Yii::$app->language);
}
开发者ID:black-lamp,项目名称:yii2-locale,代码行数:16,代码来源:ParseRequestTest.php
示例14: createDirectoryRecursive
/**
* Create a directory recursive
*
* @param $path
*/
public function createDirectoryRecursive($path)
{
// @todo UNIX ONLY?
if (substr($path, 0, 1) !== '/') {
$path = \Codeception\Configuration::projectDir() . $path;
} elseif (!strstr($path, \Codeception\Configuration::projectDir())) {
throw new \InvalidArgumentException('Can\'t create directroy "' . $path . '" as it is outside of the project root "' . \Codeception\Configuration::projectDir() . '"');
}
if (!is_dir(dirname($path))) {
self::createDirectoryRecursive(dirname($path));
}
if (!is_dir($path)) {
\Codeception\Util\Debug::debug('Directory "' . $path . '" does not exist. Try to create it ...');
mkdir($path);
}
}
开发者ID:sascha-egerer,项目名称:css-regression,代码行数:21,代码来源:FileSystem.php
示例15: testHideDefaoultLanguage
public function testHideDefaoultLanguage()
{
$mockApp = $this->app;
/** @var \bl\locale\UrlManager $urlManager */
$urlManager = clone $mockApp->urlManager;
$urlManager->showDefault = false;
$url = 'site/index';
\Codeception\Util\Debug::debug("Default language: {$mockApp->sourceLanguage}");
$actual = $urlManager->createUrl([$url, $urlManager->languageKey => 'en-US']);
$expected = implode('/', ['', $url]);
\Codeception\Util\Debug::debug("Hiden default language: {$actual}");
$this->tester->assertEquals($expected, $actual);
$language = 'ru-RU';
$actual = $urlManager->createUrl([$url, $urlManager->languageKey => $language]);
$expected = implode('/', ['', $language, $url]);
\Codeception\Util\Debug::debug("Change language: {$actual}");
$this->tester->assertEquals($actual, $expected);
}
开发者ID:black-lamp,项目名称:yii2-locale,代码行数:18,代码来源:CreateUrlTest.php
示例16: __construct
public function __construct($options)
{
$this->options = $options;
$this->debug = $options['debug'] || $options['verbosity'] >= OutputInterface::VERBOSITY_VERY_VERBOSE;
$this->steps = $this->debug || $options['steps'];
$this->rawStackTrace = $options['verbosity'] === OutputInterface::VERBOSITY_DEBUG;
$this->output = new Output($options);
if ($this->debug) {
Debug::setOutput($this->output);
}
foreach (['html', 'xml', 'tap', 'json'] as $report) {
if (!$this->options[$report]) {
continue;
}
$path = $this->absolutePath($this->options[$report]);
$this->reports[] = sprintf("- <bold>%s</bold> report generated in <comment>file://%s</comment>", strtoupper($report), $path);
}
}
开发者ID:vladislavl-hyuna,项目名称:crmapp,代码行数:18,代码来源:Console.php
示例17: canExecuteScripts
/**
* @test
*/
public function canExecuteScripts()
{
// Get a log mock
$log = $this->makeLogMock();
$log->shouldReceive('info')->withAnyArgs();
$targetA = $this->outputPath() . 'lsOutput.txt';
$targetB = $this->outputPath() . 'lsAhlOutput.txt';
$handler = $this->makeScriptsHandler($log);
$scripts = [new CliScript(['script' => 'ls > ' . $targetA]), new CliScript(['script' => 'ls -ahl > ' . $targetB])];
$handler->processElement($scripts);
$this->assertFileExists($targetA, 'First script did not output!');
$this->assertFileExists($targetB, 'Second script did not output!');
$contentA = file_get_contents($targetA);
$contentB = file_get_contents($targetB);
Debug::debug($contentA);
Debug::debug($contentB);
$this->assertNotEmpty($contentA, 'First output file has no content');
$this->assertNotEmpty($contentB, 'Second output file has no content');
}
开发者ID:aedart,项目名称:scaffold,代码行数:22,代码来源:ScriptsHandlerTest.php
示例18: execute
public function execute(InputInterface $input, OutputInterface $output)
{
$suiteName = $input->getArgument('suite');
$this->output = $output;
$config = Configuration::config($input->getOption('config'));
$settings = Configuration::suiteSettings($suiteName, $config);
$options = $input->getOptions();
$options['debug'] = true;
$options['silent'] = true;
$options['interactive'] = false;
$options['colors'] = true;
Debug::setOutput(new Output($options));
$this->codecept = new Codecept($options);
$dispatcher = $this->codecept->getDispatcher();
$suiteManager = new SuiteManager($dispatcher, $suiteName, $settings);
$suiteManager->initialize();
$this->suite = $suiteManager->getSuite();
$moduleContainer = $suiteManager->getModuleContainer();
$this->actions = array_keys($moduleContainer->getActions());
$this->test = (new Cept())->configDispatcher($dispatcher)->configModules($moduleContainer)->configName('')->config('file', '')->initConfig();
$scenario = new Scenario($this->test);
if (isset($config["namespace"])) {
$settings['class_name'] = $config["namespace"] . '\\' . $settings['class_name'];
}
$actor = $settings['class_name'];
$I = new $actor($scenario);
$this->listenToSignals();
$output->writeln("<info>Interactive console started for suite {$suiteName}</info>");
$output->writeln("<info>Try Codeception commands without writing a test</info>");
$output->writeln("<info>type 'exit' to leave console</info>");
$output->writeln("<info>type 'actions' to see all available actions for this suite</info>");
$suiteEvent = new SuiteEvent($this->suite, $this->codecept->getResult(), $settings);
$dispatcher->dispatch(Events::SUITE_BEFORE, $suiteEvent);
$dispatcher->dispatch(Events::TEST_PARSED, new TestEvent($this->test));
$dispatcher->dispatch(Events::TEST_BEFORE, new TestEvent($this->test));
$output->writeln("\n\n<comment>\$I</comment> = new {$settings['class_name']}(\$scenario);");
$scenario->stopIfBlocked();
$this->executeCommands($input, $output, $I, $settings['bootstrap']);
$dispatcher->dispatch(Events::TEST_AFTER, new TestEvent($this->test));
$dispatcher->dispatch(Events::SUITE_AFTER, new SuiteEvent($this->suite));
$output->writeln("<info>Bye-bye!</info>");
}
开发者ID:hitechdk,项目名称:Codeception,代码行数:42,代码来源:Console.php
示例19: __construct
public function __construct($options)
{
$this->prepareOptions($options);
$this->output = new Output($options);
$this->messageFactory = new MessageFactory($this->output);
if ($this->debug) {
Debug::setOutput($this->output);
}
$this->detectWidth();
if ($this->options['ansi'] && !$this->isWin()) {
$this->chars['success'] = '✔';
$this->chars['fail'] = '✖';
}
foreach (['html', 'xml', 'tap', 'json'] as $report) {
if (!$this->options[$report]) {
continue;
}
$path = $this->absolutePath($this->options[$report]);
$this->reports[] = sprintf("- <bold>%s</bold> report generated in <comment>file://%s</comment>", strtoupper($report), $path);
}
}
开发者ID:solutionDrive,项目名称:Codeception,代码行数:21,代码来源:Console.php
示例20: hasInstalledVimConfigurationInTargetDirectory
/**
* @test
*
* @throws \Codeception\Exception\ConfigurationException
*/
public function hasInstalledVimConfigurationInTargetDirectory()
{
$target = Configuration::outputDir() . 'vimConfigTest';
$this->cleanupFolder($target);
Debug::debug('<info>Preparing command...</info>');
$command = $this->getCommand();
Debug::debug('<info>Preparing question helper...</info>');
$this->mockQuestionHelper($command, function ($test, $order, ConfirmationQuestion $question) {
// Pick the first choice
if ($order == 0) {
return true;
}
throw new UnhandledQuestionException();
});
Debug::debug('<info>Executing...</info>');
$tester = new \Symfony\Component\Console\Tester\CommandTester($command);
$tester->execute([VimConfigurationInstallCommand::TARGET_DIR_ARGUMENT => $target]);
$output = $tester->getDisplay();
Debug::debug($output);
$finder = new Finder();
$count = $finder->directories()->ignoreDotFiles(false)->in($target)->count();
$this->assertNotEquals(0, $count, 'No files have been copied!');
}
开发者ID:bszala,项目名称:scaffold,代码行数:28,代码来源:VimConfigurationInstallCommandTest.php
注:本文中的Codeception\Util\Debug类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论