本文整理汇总了PHP中Codeception\Util\Debug类的典型用法代码示例。如果您正苦于以下问题:PHP Debug类的具体用法?PHP Debug怎么用?PHP Debug使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Debug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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);
}
示例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);
}
示例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()));
}
}
示例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;
}
示例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());
}
}
示例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);
}
}
示例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());
}
示例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} ");
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}