本文整理汇总了PHP中codecept_debug函数的典型用法代码示例。如果您正苦于以下问题:PHP codecept_debug函数的具体用法?PHP codecept_debug怎么用?PHP codecept_debug使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了codecept_debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIfWillProperlyReadDocComment
public function testIfWillProperlyReadDocComment()
{
$class = new ReflectionClass(AbstractSettings::class);
$doc = new \Maslosoft\Addendum\Builder\DocComment();
$data = $doc->forClass($class);
codecept_debug($data);
}
示例2: tryToTest
public function tryToTest(FunctionalTester $I)
{
$I->amOnPage('/');
$I->see('Symfony Blog', 'title');
$res = $I->dontSeeInRepository('AppBundle/User');
codecept_debug($res);
}
示例3: testIfWillProperlyCreateAndSaveEmbedRefsFromPostData
public function testIfWillProperlyCreateAndSaveEmbedRefsFromPostData()
{
// POST data from real application
$data = ['items' => [0 => ['title' => '', 'description' => '', 'hasText' => false, 'items' => [0 => ['filename' => '', 'file' => ['width' => 0, 'height' => 0, 'filename' => '', 'size' => 0, 'rootClass' => '', 'rootId' => '', 'contentType' => '', '_id' => '56336cccc79fda857b8b4b0e', '_key' => '', '_class' => 'Maslosoft\\Mangan\\Model\\Image', 'meta' => [], 'rawI18N' => []], 'basename' => '', 'relativeName' => '', 'icon' => '/css/filetypes/512/_blank.png', 'isImage' => false, 'iconSize' => 512, 'path' => '', 'url' => '/assets/get/56336cccc79fda857b8b4b06', 'type' => '', 'deleted' => false, 'title' => '', 'description' => '', 'id' => '56336cccc79fda857b8b4b06', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b06', '_key' => '56336ccbc79fda857b8b4b00', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\PageAsset', 'meta' => [], 'parentId' => NULL], 1 => ['filename' => '', 'file' => ['width' => 0, 'height' => 0, 'filename' => '', 'size' => 0, 'rootClass' => '', 'rootId' => '', 'contentType' => '', '_id' => '56336cccc79fda857b8b4b0f', '_key' => '', '_class' => 'Maslosoft\\Mangan\\Model\\Image', 'meta' => [], 'rawI18N' => []], 'basename' => '', 'relativeName' => '', 'icon' => '/css/filetypes/512/_blank.png', 'isImage' => false, 'iconSize' => 512, 'path' => '', 'url' => '/assets/get/56336cccc79fda857b8b4b08', 'type' => '', 'deleted' => false, 'title' => '', 'description' => '', 'id' => '56336cccc79fda857b8b4b08', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b08', '_key' => '56336cccc79fda857b8b4b01', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\PageAsset', 'meta' => [], 'parentId' => NULL], 2 => ['filename' => '', 'file' => ['width' => 0, 'height' => 0, 'filename' => '', 'size' => 0, 'rootClass' => '', 'rootId' => '', 'contentType' => '', '_id' => '56336cccc79fda857b8b4b10', '_key' => '', '_class' => 'Maslosoft\\Mangan\\Model\\Image', 'meta' => [], 'rawI18N' => []], 'basename' => '', 'relativeName' => '', 'icon' => '/css/filetypes/512/_blank.png', 'isImage' => false, 'iconSize' => 512, 'path' => '', 'url' => '/assets/get/56336cccc79fda857b8b4b0a', 'type' => '', 'deleted' => false, 'title' => '', 'description' => '', 'id' => '56336cccc79fda857b8b4b0a', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b0a', '_key' => '56336cccc79fda857b8b4b02', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\PageAsset', 'meta' => [], 'parentId' => NULL]], 'assetsCount' => 0, 'id' => '56336cccc79fda857b8b4b0b', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b0b', '_key' => '56336ccbc79fda857b8b4aff', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\AssetGroup', 'meta' => [], 'parentId' => ''], 1 => ['title' => 'Some title', 'description' => '', 'hasText' => true, 'items' => [], 'assetsCount' => 0, 'id' => '56336cccc79fda857b8b4b0c', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => 'Some title'], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b0c', '_key' => '56336cccc79fda857b8b4b03', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\AssetGroup', 'meta' => [], 'parentId' => '']], 'title' => '', 'description' => '', 'groupCount' => 0, 'assetsCount' => 0, 'id' => '56336cccc79fda857b8b4b0d', 'createUser' => NULL, 'createDate' => 0, 'updateUser' => NULL, 'updateDate' => 0, 'rawI18N' => ['title' => ['en' => ''], 'description' => ['en' => '']], '_id' => '56336cccc79fda857b8b4b0d', '_key' => '56336ccbc79fda857b8b4afe', '_class' => 'Maslosoft\\ManganTest\\Models\\DbRef\\AssetCollection', 'meta' => []];
$model = SafeArray::toModel($data);
$handler = function (ModelEvent $event) {
$event->isValid = true;
codecept_debug('EntityManager::EventBeforeSave');
};
Event::on($model, EntityManager::EventBeforeSave, $handler);
$this->assertTrue($model instanceof AssetCollection);
$this->assertSame(2, count($model->items));
$this->assertTrue($model->items[0] instanceof AssetGroup);
$this->assertTrue($model->items[1] instanceof AssetGroup);
$this->assertSame(3, count($model->items[0]->items));
$this->assertTrue($model->items[0]->items[0] instanceof PageAsset);
$this->assertTrue($model->items[0]->items[1] instanceof PageAsset);
$this->assertTrue($model->items[0]->items[2] instanceof PageAsset);
codecept_debug(get_class($model->items[0]));
/* @var $model AssetCollection */
$saved = $model->save();
$this->assertTrue($saved);
$found = $model->findByPk($model->id);
$this->assertNotNull($found);
$this->assertTrue($found instanceof AssetCollection);
$this->assertSame(2, count($found->items));
$this->assertTrue($found->items[0] instanceof AssetGroup);
}
示例4: system
public function system($command, &$returnVar = null)
{
ob_start();
$output = system($command, $returnVar);
codecept_debug(static::class . " executed command:\n\t{$command}\nwith output:\n\t\$" . ob_get_clean());
return $output;
}
示例5: testRenderWithCache
public function testRenderWithCache(IntegrationTester $I)
{
$I->wantToTest('Render by using simple view with cache');
if (PHP_MAJOR_VERSION == 7) {
throw new \PHPUnit_Framework_SkippedTestError('Skipped in view of the experimental support for PHP 7.');
}
// Create cache at first run
$view = new Simple();
codecept_debug(gettype($view->getParamsToView()));
$view->setViewsDir(PATH_DATA . 'views/');
// No cache before DI is set
$I->assertFalse($view->getCache());
$view->setDI($this->getDi());
$I->assertEquals($view, $view->cache(['key' => 'view_simple_cache']));
$cache = $view->getCache();
$I->assertInstanceOf('Phalcon\\Cache\\BackendInterface', $cache);
$timeNow = time();
$view->setParamToView('a_cool_var', $timeNow);
$I->assertEquals("<p>{$timeNow}</p>", rtrim($view->render('test3/coolVar')));
$I->amInPath(PATH_CACHE);
$I->seeFileFound('view_simple_cache');
$I->seeInThisFile("<p>{$timeNow}</p>");
unset($view, $cache);
// Re-use the cached contents
$view = new Simple();
$view->setViewsDir(PATH_DATA . 'views/');
$view->setDI($this->getDi());
$view->cache(['key' => 'view_simple_cache']);
$I->assertEmpty($view->getContent());
$I->assertEquals("<p>{$timeNow}</p>", rtrim($view->render('test3/coolVar')));
$I->assertNotEmpty($view->getContent());
$I->assertEquals("<p></p>", rtrim($view->render('test3/coolVar')));
$I->deleteFile('view_simple_cache');
}
示例6: testIfWillResizeSavedImage
public function testIfWillResizeSavedImage()
{
// Temp file location
$fileName = __DIR__ . '/logo-1024.png';
$md5 = md5_file($fileName);
$model = new ModelWithEmbeddedFile();
$model->file = new Image();
$model->file->set($fileName);
$em = new EntityManager($model);
$em->save();
$finder = new Finder($model);
$found = $finder->findByPk($model->_id);
/* @var $found ModelWithEmbeddedFile */
$file = $found->file->get()->getBytes();
$this->assertSame($fileName, $found->file->filename);
$this->assertSame($md5, md5($file));
$image = $found->file;
$params = new ImageParams();
$params->width = 100;
$params->height = 100;
/* @var $image Image */
$scaledName = tempnam('/tmp/', 'image-test') . '.png';
$image->get($params)->write($scaledName);
$this->assertTrue(file_exists($scaledName));
$gd = new GD($scaledName);
$dimensions = (object) $gd->getCurrentDimensions();
codecept_debug($dimensions);
$this->assertSame($params->width, $dimensions->width);
$this->assertSame($params->height, $dimensions->height);
}
示例7: loadConfiguredGroupSettings
protected function loadConfiguredGroupSettings()
{
foreach ($this->configuredGroups as $group => $tests) {
$this->testsInGroups[$group] = [];
if (is_array($tests)) {
foreach ($tests as $test) {
$file = str_replace(['/', '\\'], [DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $test);
$this->testsInGroups[$group][] = Configuration::projectDir() . $file;
}
} elseif (is_file(Configuration::projectDir() . $tests)) {
$handle = @fopen(Configuration::projectDir() . $tests, "r");
if ($handle) {
while (($test = fgets($handle, 4096)) !== false) {
// if the current line is blank then we need to move to the next line
// otherwise the current codeception directory becomes part of the group
// which causes every single test to run
if (trim($test) === '') {
continue;
}
$file = trim(Configuration::projectDir() . $test);
$file = str_replace(['/', '\\'], [DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $file);
$this->testsInGroups[$group][] = $file;
}
fclose($handle);
}
} else {
codecept_debug("Group '{$group}' is empty, no tests are loaded");
}
}
}
示例8: testToString
/**
* @dataProvider values
* @param $operator
* @param $result
* @param $expression
*/
public function testToString($operator, $result, $expression)
{
$operator = new Parentheses($operator);
expect("expression " . $expression, $operator->render())->equals($expression);
expect("expression " . $expression, (string) $operator)->equals($expression);
codecept_debug($operator->render());
}
示例9: testRender
/**
* @param $expr
* @param $result
* @param $expected
* @dataProvider values
*/
public function testRender($expr, $result, $expected)
{
codecept_debug($expr);
$this->expression->fromString($expr, new Formula(new Lexer()));
expect("render expression {$expected}", $this->expression->render())->equals($expected);
codecept_debug($this->expression->render());
}
示例10: _initialize
/**
* @inheritdoc
*/
public function _initialize()
{
// compute datbase info
$match = preg_match("/host=(.*);dbname=(.*)/", env("DB_DSN"), $matches);
if (!$match) {
return;
}
$host = $matches[1];
$name = $matches[2] . "_test";
$user = env("DB_USER");
$pass = env("DB_PASS");
// compute dump file
$dumpFile = $this->config['dump'] ?: "tests/_data/dump.sql";
$dumpFile = Configuration::projectDir() . $dumpFile;
if (!file_exists($dumpFile)) {
throw new ModuleException(__CLASS__, "Dump file does not exist [ {$dumpFile} ]");
}
// dump
$cmd = "mysql -h {$host} -u {$user} -p{$pass} {$name} < {$dumpFile}";
$start = microtime(true);
$output = shell_exec($cmd);
$end = microtime(true);
$diff = round(($end - $start) * 1000, 2);
// output debug info
$className = get_called_class();
codecept_debug("{$className} - Importing db [ {$name} ] [ {$diff} ms ]");
// check for error
if ($output) {
throw new ModuleException(__CLASS__, "Failed to import db [ {$cmd} ]");
}
}
示例11: testIfWillProperlyCacheNamespacesForDifferentMetaContainers
public function testIfWillProperlyCacheNamespacesForDifferentMetaContainers()
{
$path = (new ConfigDetector())->getRuntimePath();
if (!is_dir($path)) {
mkdir($path);
}
// Simulate different meta container classes by creating different paths
$path1 = sprintf('%s/path1', $path);
$path2 = sprintf('%s/path2', $path);
$path3 = sprintf('%s/path3', $path);
if (!is_dir($path1)) {
mkdir($path1);
}
if (!is_dir($path2)) {
mkdir($path2);
}
if (!is_dir($path3)) {
mkdir($path3);
}
$ns1 = new NsCache($path1, Addendum::fly(), new CacheOptionsOne());
$ns1->set();
codecept_debug($ns1->get());
$this->assertTrue($ns1->valid());
$ns2 = new NsCache($path2, Addendum::fly(), new CacheOptionsTwo());
$ns2->set();
codecept_debug($ns2->get());
$this->assertTrue($ns1->valid());
$this->assertTrue($ns2->valid());
$ns3 = new NsCache($path3, Addendum::fly(), new CacheOptionsOne());
$ns3->set();
codecept_debug($ns3->get());
$this->assertTrue($ns1->valid());
$this->assertTrue($ns2->valid());
$this->assertTrue($ns3->valid());
}
示例12: testImageComparer
public function testImageComparer(FunctionalTester $I)
{
$I->amInPath($this->workDir);
copy(codecept_data_dir() . 'image1.png', $this->workDir . '/image1.png');
copy(codecept_data_dir() . 'image2.png', $this->workDir . '/image2.png');
copy(codecept_data_dir() . 'image3.png', $this->workDir . '/image3.png');
$comparer = new ImageComparer();
// Check difference between the same image.
$difference = $comparer->difference('image1.png', 'image1.png', 'image.diff.png');
$I->assertTrue($difference === 0);
$I->assertTrue(file_exists('image.diff.png'));
unlink('image.diff.png');
// Compare different images.
$difference = $comparer->difference('image1.png', 'image2.png', 'image.diff.png');
$I->assertTrue($difference > 0);
codecept_debug($difference);
$I->assertTrue(file_exists('image.diff.png'));
// Compare different sized images.
$difference = $comparer->difference('image1.png', 'image3.png', 'image.diff.png');
$I->assertTrue($difference > 0);
codecept_debug($difference);
$I->assertTrue(file_exists('image.diff.png'));
// Check missing command.
$comparer->setCommand('this_command_doesnt_exist');
try {
$difference = $comparer->difference('image1.png', 'image2.png', 'image.diff.png');
$I->fail("Bad command didn't throw an Exception");
} catch (Exception $e) {
// All good.
}
}
示例13: updateActor
public function updateActor(SuiteEvent $e)
{
$settings = $e->getSettings();
$modules = $e->getSuite()->getModules();
$actorActionsFile = Configuration::supportDir() . '_generated' . DIRECTORY_SEPARATOR . $settings['class_name'] . 'Actions.php';
if (!file_exists($actorActionsFile)) {
codecept_debug("Generating {$settings['class_name']}Actions...");
$this->generateActorActions($actorActionsFile, $settings);
return;
}
// load actor class to see hash
$handle = @fopen($actorActionsFile, "r");
if ($handle and is_writable($actorActionsFile)) {
$line = @fgets($handle);
if (preg_match('~\\[STAMP\\] ([a-f0-9]*)~', $line, $matches)) {
$hash = $matches[1];
$currentHash = Actions::genHash($modules, $settings);
// regenerate actor class when hashes do not match
if ($hash != $currentHash) {
codecept_debug("Rebuilding {$settings['class_name']}...");
@fclose($handle);
$this->generateActorActions($actorActionsFile, $settings);
return;
}
}
@fclose($handle);
}
}
示例14: testGetQuoteFromWebServiceX
public function testGetQuoteFromWebServiceX()
{
$client = new \ITMH\Soap\Client('http://www.webservicex.net/StockQuote.asmx?WSDL', []);
$result = $client->GetQuote(['symbol' => 'USD']);
codecept_debug($result);
self::assertTrue($result !== false);
}
示例15: testLoadFunc
public function testLoadFunc()
{
$this->funcInjector->save();
codecept_debug($this->funcInjector->getFileName());
$this->funcInjector->inject();
verify(strlen('hello'))->equals(5);
}