text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>');
BaseYii::warning('warning message', 'warning category');
BaseYii::debug('trace message', 'trace category');
BaseYii::error('error message', 'error category');
BaseYii::beginProfile('beginProfile message', 'beginProfile category');
BaseYii::endProfile('endProfile... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework;
use yiiuni<|fim_suffix|>geProvider(): array
{
$lines = preg_split('~\R~', file_get_... | fim | yiisoft/yii2 | php |
<|fim_suffix|>pment\n"
. "-----------------------\n\n"
. "- Enh #2: Test enhancement (samdark)\n"
. "- Fix #1: Test fix (samdark)\n"
);
$controller = $this->createController();
$controller->basePath = $basePath;
$method = new ReflectionMethod($control... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\ar;
use yiiunit\extensions\redis\ActiveRecordTest;
use Exception;
use yii\base\Event;
use yii\db\BaseActiveRecord;
use yii\db\Expression... | fim | yiisoft/yii2 | php |
<|fim_suffix|>ue;
}
/**
* {@inheritdoc}
*/
public function afterAction($action, $result)
{
return $result . '-3';
}
}
class MockUser extends User
{
public function init(): void
{
// do not call parent to avoid the need to mock configuration
}
}
<|fim_prefix|><... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use Yii;
use yii\base\BootstrapInterface;
use yii\base\Component;
use yii\base\Module;
use yii\log\Dispa... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use JsonSerializable;
use yii\base\Arrayable;
use yii\base\ArrayableTrait;
use yii\base\Mo... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use yii\base\BaseObject;
use yiiunit\TestCase;
/**
* @group base
*/
class BaseObjectTes... | fim | yiisoft/yii2 | php |
<|fim_suffix|>oClass();
$this->assertEquals(0, BarBehavior::$attachCount);
$this->assertEquals(0, BarBehavior::$detachCount);
$this->assertEquals('behavior property', $foo->behaviorProperty);
$this->assertEquals('behavior method', $foo->behaviorMethod());
$this->assertEquals(1, B... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use yii\base\Behavior;
use yii\base\Component;
use yii\base\Event;
use yii\base\InvalidCon... | fim | yiisoft/yii2 | php |
<|fim_suffix|>nput, $expected): void
{
$this->assertSame($expected, preg_match('/^(?:[a-z0-9_]+-)*[a-z0-9_]+$/', $input));
}
public static function actionIdMethodProvider(): array
{
return [
['apple-id', 1],
['-apple', 0],
['apple.', 0],
[... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use yii\base\DynamicModel;
use yiiunit\TestCase;
/**
* @group base
*/
class DynamicMode... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use yii\base\ErrorException;
use yiiunit\TestCase;
/**
* @group base
*/
class ErrorExce... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use stdClass;
use yii\base\Component;
use yii\base\Event;
use yiiunit\TestCase;
/**
* @g... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiuni<|fim_suffix|>rent::pbkdf2($algo, $password, $salt, $iterations, $length);
}
}
<|fim_middle|>t\framework\base;
use yii\base\Securi... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use yii\base\DynamicModel;
use yii\base\InvalidArgumentException;
use yii\base\Model;
use ... | fim | yiisoft/yii2 | php |
<|fim_suffix|>$controller->uniqueId);
list($controller, $action) = $module->createController('base/other/index');
$this->assertSame('index', $action);
$this->assertSame('app/base/other', $controller->uniqueId);
list($controller, $action) = $module->createController('base/other/someacti... | fim | yiisoft/yii2 | php |
<|fim_suffix|>be840e5994b127b147d1a0c
64f1cea9115a37225c8b49960e0693680ee5593c81784c850811e1f10ce4f9a3
365e3d2d240e0eef8da6404d5a93ebd000a98d5d33dd5a238327e88dfdad2744
ed0c4321a543c1a3231e53550e816c531b73bafec21e32daeecd199c7a2be75f
450ce4d39e10ad81a7ca748... | fim | yiisoft/yii2 | php |
<|fim_suffix|>odel, Speaker::instance(true));
}
}
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @li<|fim_middle|>cense https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use yiiunit\data\base\... | fim | yiisoft/yii2 | php |
<|fim_suffix|>heme = new Theme($config);
$expected = Yii::getAlias(Yii::$app->basePath . '/views/main/index.php');
$actual = $theme->applyTo($expected);
$this->assertPathEquals($expected, $actual);
}
}
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright ... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\base;
use Exception;
use Yii;
use yii\base\Theme;
use yii\base\View;
use yii\base\ViewEvent;
use... | fim | yiisoft/yii2 | php |
<|fim_suffix|>ii\base\InvalidCallException');
TestWidgetA::begin();
TestWidgetB::begin();
TestWidgetA::end();
TestWidgetB::end();
}
/**
* @depends testWidget
*/
public function testEvents(): void
{
$output = TestWidget::widget([
'id' => 'tes... | fim | yiisoft/yii2 | php |
<|fim_suffix|>m/license/
*/
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Y<|fim_middle|>ii Software LLC
* @license https://www.yiiframework.co<|endoftext|> | fim | yiisoft/yii2 | php |
<|fim_suffix|> Software LLC
* @license https://www.yiiframework.com/license/
*/
<|fim_prefix|><?php
/<|fim_middle|>**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii<|endoftext|> | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
<|endoftext|> | fim | yiisoft/yii2 | php |
<|fim_suffix|>ic function events()
{
return [
'barEventOnce' => function ($event) {
$this->owner->foo++;
$this->detach();
},
];
}
}));
return $obj;
<|fim_prefix|><?php
declare(stri<|fim_middle|>ct_types=1);
use yii\base\Component;
use yi... | fim | yiisoft/yii2 | php |
<?php
declare(strict_types=1);
use yii\base\Model;
return new class () extends Model {
};
<|endoftext|> | fim | yiisoft/yii2 | php |
<|fim_suffix|>'attributes' => [
self::EVENT_BEFORE_VALIDATE => 'alias',
],
'value' => function ($event) {
return $event->sender->name;
},
],
];
}
/**
* {@inheritdoc}
*/
public static functi... | fim | yiisoft/yii2 | php |
<|fim_suffix|>me(StatusTypeString::Active, $model->status);
}
/**
* @depends testTypecastEnum
*/
public function testTypecastEnumFromString(): void
{
if (PHP_VERSION_ID < 80100) {
$this->markTestSkipped('Can not be tested on PHP < 8.1');
}
$model = new Act... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyrigh<|fim_suffix|>or->preserveNonEmptyValues = $preserveNonEmptyValues;
$model->name = $name;
$model->alias = $alias;
$model->validate();
$this->assertEquals($aliasExpected, $model->alias);
}
/**
* @re... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\behaviors;
use Yii;
use yii\behaviors\BlameableBehavior;
use yii\db\ActiveRecord;
use yiiunit\Te... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\framework\behaviors;
use Yii;
use yii\base\BaseObject;
use yii\behaviors\BlameableBehavior;
use yii\db\Act... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
namespace yiiunit\framework\behaviors;
use Exception;
use PHPUnit\Framework\MockObject\MockObject;
use yii\base\Widget;
use yii\behaviors\CacheableWidgetBehavior;
use yiiunit\TestCase;
/**
* Unit test for [[\yii\behaviors\CacheableWidgetBehavior]].
*
* @see CacheableWidgetBehavior
* @group <|... | fim | yiisoft/yii2 | php |
<|fim_suffix|> public static function tableName()
{
return static::$tableName;
}
}
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
declare(strict_types=1);
namespace yiiunit\frame... | fim | yiisoft/yii2 | php |
<|fim_suffix|>ateCommand()->createTable('test_slug', $columns)->execute();
$columns = [
'id' => 'pk',
'name' => 'string',
];
Yii::$app->getDb()->createCommand()->createTable('test_slug_related', $columns)->execute();
}
protected function tearDown(): void
{
... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\behaviors;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
use yii\db\Connection;
use yii\db\Expres... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\caching;
use yii\caching\ApcCache;
/**
* Class for testing APC cache backend.
* @group apc
* @group caching
*/
class ApcCacheTest e... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\caching;
use yii\caching\ArrayCache;
/**
* Class for testing file cache backend.
* @group caching
*/
class ArrayCacheT... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yii\caching;
/**
* Mock for the time() function for caching classes.
* @return int
*/
function time()
{
return \yiiunit\framework\cac... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
namespace yiiunit\framework\caching;
use PHPUnit\Framework\TestCase;
use yii\caching\ArrayCache;
use yii\caching\CallbackDependency;
class CallbackDependencyTest extends TestCase
{
public function testDependencyChange(): void
{
$cache = new ArrayCache();
$dependencyValue =... | fim | yiisoft/yii2 | php |
<|fim_suffix|>his->getConnection()]);
}
return $this->_cacheInstance;
}
public function testExpire(): void
{
$cache = $this->getCacheInstance();
static::$time = \time();
$this->assertTrue($cache->set('expire_test', 'expire_test', 2));
static::$time++;
... | fim | yiisoft/yii2 | php |
<|fim_suffix|> $db;
$dependency->sql = 'SELECT [[id]] FROM {{dependency_item}} ORDER BY [[id]] DESC LIMIT 1';
$dependency->reusable = false;
$dependency->evaluateDependency($cache);
$this->assertFalse($dependency->isChanged($cache));
$db->createCommand()->insert('dependency_ite... | fim | yiisoft/yii2 | php |
<|fim_suffix|>
public function testIsChanged(): void
{
$db = $this->getConnection(false);
$cache = new ArrayCache();
$dependency = new DbQueryDependency();
$dependency->db = $db;
$dependency->query = (new Query())
->select(['id'])
->from('dependen... | fim | yiisoft/yii2 | php |
<|fim_suffix|> $result = $this->invokeMethod($dependency, 'generateReusableHash');
$this->assertEquals(5, strlen($dependency->data));
$this->assertEquals(40, strlen($result));
}
public function testIsChanged(): void
{
$dependency = $this->getMockForAbstractClass(Dependency::class)... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\caching;
use ReflectionClass;
use yii\caching\FileCache;
/**
* Class for testing file cache backend.
* @group caching
... | fim | yiisoft/yii2 | php |
<|fim_suffix|>kend.
* @group memcache
* @group caching
*/
class MemCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
/**
* @return MemCache
*/
protected function getCacheInstance()
{
if (!extension_loaded('memcache')) {
$this->markTestSkipped('memcache n... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\caching;
use yii\caching\MemCache;
/**
* Class for testing memcached cache backend.
* @group memcached
* @group cachin... | fim | yiisoft/yii2 | php |
<|fim_suffix|>ertFalse($cache->get('expire_test'));
}
public function testExpireAdd(): void
{
$cache = $this->getCacheInstance();
static::$time = \time();
$this->assertTrue($cache->add('expire_testa', 'expire_testa', 2));
static::$time++;
$this->assertEquals('expire... | fim | yiisoft/yii2 | php |
<|fim_suffix|>tic::$driverName];
$db = new Connection();
$db->dsn = $params['dsn'];
$db->username = $params['username'];
$db->password = $params['password'];
if ($reset) {
$db->open();
$lines = explode(';', file_get_contents($pa... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.<|fim_suffix|>rtEquals(21, $cache->get('b1'));
$this->assertEquals(22, $cache->get('b2'));
TagDependency::invalidate($cache, 't2');
$this->assertFalse($cache->get('a1'));
$this->assertFalse($cache->get('a2'));
$this->ass... | fim | yiisoft/yii2 | php |
<|fim_suffix|>WinCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
/**
* @return WinCache
*/
protected function getCacheInstance()
{
if (!extension_loaded('wincache')) {
$this->markTestSkipped('Wincache not installed. Skipping.');
}
if (!in... | fim | yiisoft/yii2 | php |
<|fim_suffix|> $controller = new FakeController('fake', Yii::$app);
$help = $controller->getActionArgsHelp($controller->createAction('aksi2'));
$this->assertArrayHasKey('values', $help);
if (PHP_MAJOR_VERSION > 5) {
// declared type
$this->assertEquals('array', $help['va... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\console;
use yii\console\Request;
use yiiunit\TestCase;
/**
* @group console
*/
class RequestTest extends TestCase
{
... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\console;
use Yii;
use yii\console\UnknownCommandException;
use yiiunit\TestCase;
/**
* @group console
*/
class UnknownC... | fim | yiisoft/yii2 | php |
<|fim_suffix|> ],
],
]);
$this->runAssetControllerAction('compress', [$configFile, $bundleFile]);
$bundlesConfig = require $bundleFile;
$this->assertEquals($assetBundleOverrideConfig['css'], $bundlesConfig[$assetBundleClassName]['css']);
$this->assertEqual... | fim | yiisoft/yii2 | php |
<|fim_suffix|>ted function getConfig($additionalConfig = [])
{
return array_merge($this->getDefaultConfig(), $additionalConfig);
}
// Tests:
public function testActionConfig(): void
{
$configFileName = $this->configFileName;
$out = $this->runMessageControllerAction('config'... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\console\controllers;
use Yii;
use yii\caching\ArrayCache;
use yii\caching\CacheInterface;
use yii\console\Application;
use yii\console\c... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\console\controllers;
use yii\console\Application;
use yii\console\Controller;
use yii\helpers\ArrayHelper;
use yii\db\Quer... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link ht<|fim_suffix|>ds MigrateController
{
/**
* {@inheritdoc}
*/
public function stdout($string)
{
echo $string;
return 0;
}
}
<|fim_middle|>tps://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiif... | fim | yiisoft/yii2 | php |
<|fim_suffix|>id
{
$this->expectException('\yii\console\Exception');
$this->_fixtureController->actionUnload(['NotExistingFixture']);
}
public function testLoadActiveFixtureSequence(): void
{
$this->assertEmpty(FixtureStorage::$activeFixtureSequence, 'Active fixture sequence sho... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\console\controllers;
use yii\base\Module;
use yii\console\controllers\HelpController;
use yii\helpers\Console;
use yiiunit... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\console\controllers;
use yii\db\Exception;
use Yii;
use yii\console\controllers\MigrateController;
use yii\console\ExitCode;
use yii\db\... | fim | yiisoft/yii2 | php |
<|fim_suffix|>ertMigrationHistory(['m*_base', 'm010101_000001_app_migration1']);
// yii migrate/up
$this->runMigrateControllerAction('up', [], $controllerConfig);
$this->assertSame(ExitCode::OK, $this->getExitCode());
$this->assertMigrationHistory([
'm*_base',
'm... | fim | yiisoft/yii2 | php |
<|fim_suffix|>', true, true, false],
'removeUnused:true - unused category should be removed - nested 3 level category' => ['multi-level/nested/category', true, true, false],
];
}
/**
* @dataProvider messageFileCategoriesDataProvider
*/
public function testRemoveUnusedBehavior(... | fim | yiisoft/yii2 | php |
<|fim_suffix|>$messageFilePath)) {
return [];
}
$gettext = new GettextPoFile();
return $gettext->load($messageFilePath, $category);
}
}
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiifr... | fim | yiisoft/yii2 | php |
<|fim_suffix|>->port = 8080;
$serveController->expects($this->once())->method('runCommand')->willReturn(true);
ob_start();
$serveController->actionIndex();
ob_end_clean();
$result = $serveController->flushStdOutBuffer();
$this->assertStringContainsString('Server start... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii<|fim_suffix|>.
*/
class SilencedCacheController extends CacheController
{
/**
* {@inheritdoc}
*/
public function stdout($string)
{
return 0;
}
}
<|fim_middle|> Software LLC
* @license... | fim | yiisoft/yii2 | php |
<|fim_suffix|>te $stdOutBuffer = '';
public function stdout($string)
{
$this->stdOutBuffer .= $string;
return 0;
}
public function flushStdOutBuffer()
{
$result = $this->stdOutBuffer;
$this->stdOutBuffer = '';
return $result;
}
}
<|fim_prefix|><?php
/**... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
<|fim_suffix|>'Hello!';
<|fim_middle|>echo <|endoftext|> | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https:/<|fim_suffix|>
<|fim_middle|>/www.yiiframework.com/license/
*/
namespace yiiunit\framework\console\stubs;
use yii\base\BaseObject;
class DummyService extends BaseObject
{
}<|endoftext... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\console\stubs;
use yii\console\Controller;
use yii\console\Response;
/**
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @sin... | fim | yiisoft/yii2 | php |
<|fim_suffix|>\controllers\HelpController;
class FakeHelpController extends HelpController
{
private static $_actionIndexLastCallParams;
public function actionIndex($command = null)
{
self::$_actionIndexLastCallParams = func_get_args();
return 0;
}
public static function getAction... | fim | yiisoft/yii2 | php |
<|fim_suffix|>
{
public $outputString = '';
public function stdout($string)
{
$this->outputString .= $string;
return 0;
}
}
<|fim_prefix|><?php
/**
* @link<|fim_middle|> https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframewor... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
name<|fim_suffix|>terface $dataProvider)
{
}
}
<|fim_middle|>space yiiunit\framework\console\stubs;
use yii\data\DataProviderInterface;
use yi... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\console\widgets;
use yii\console\widgets\Table;
use yii\helpers\Console;
use yiiunit\TestCase;
/**
* @group console
*/
... | fim | yiisoft/yii2 | php |
<|fim_suffix|>foo',
],
];
$expectedResult = ['CALLBACK-LIKE', 'LIKE', 'foo', 'name'];
$this->assertEquals($expectedResult, $builder->build());
}
}
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https:/... | fim | yiisoft/yii2 | php |
<|fim_suffix|>t;
$querySecond = $dataProviderSecond->query;
$this->assertNotSame($querySecond, $queryFirst);
}
}
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiuni... | fim | yiisoft/yii2 | php |
<|fim_suffix|>query = new UnqueryableQueryMock();
$provider = new ActiveDataProvider([
'db' => $this->getConnection(),
'query' => $query->from('order')->where('0=1'),
]);
$pagination = $provider->getPagination();
$this->assertEquals(0, $pagination->getPageCount())... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\data;
use yii\data\ArrayDataProvider;
use yiiunit\TestCase;
/**
* @group data
*/
class ArrayDataProviderTest extends Te... | fim | yiisoft/yii2 | php |
<|fim_suffix|>return 0;
}
}
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\data;
use ReflectionClass;
use yii\data\BaseDataProvider;
use yiiunit\TestCase;
/**
* @g... | fim | yiisoft/yii2 | php |
<|fim_suffix|>dResult, $builder->normalize(false));
}
public function testNormalizeNonDefaultNull(): void
{
$builder = new DataFilter();
$builder->nullValue = 'abcde';
$builder->setSearchModel((new DynamicModel(['name' => null]))->addRule('name', 'string'));
$builder->filter... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\data;
use yii\data\Pagination;
use yii\web\Link;
use yiiunit\TestCase;
/**
* @group data
*/
class PaginationTest extend... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\data;
use yii\data\Sort;
use yii\web\UrlManager;
use yiiunit\TestCase;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* ... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\data;
use yii\data\SqlDataProvider;
use yiiunit\framework\db\DatabaseTestCase;
/**
* @group data
*/
class SqlDataProvid... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008<|fim_suffix|>ction setUp(): void
{
$this->globalConnection = $this->getMockBuilder('yii\db\Connection')->getMock();
$this->modelConnection = $this->getMockBuilder('yii\db\Connection')->getMock();
... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
use yii\base\Event;
use yii\db\ActiveQuery;
use yii\db\Connection;
use yii\db\QueryBuilder;
use yiiunit\data\ar\ActiveRecord;
use yi... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
use Yii;
use yii\base\InvalidArgumentException;
use yii\base\InvalidConfigException;
use yii\db\ActiveQuery;
use yii\d... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
class AnyCaseValue extends CompareValue
{
public $value;
/**
* Constructor.
* @param string|string[] $value
... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
class AnyValue extends CompareValue
{
/**
* @var self
*/
private static $_instance;
public static function ge... | fim | yiisoft/yii2 | php |
<?php
namespace yiiunit\framework\db;
use yiiunit\data\ar\ActiveRecord;
abstract class BaseActiveRecordTest extends DatabaseTestCase
{
protected function setUp(): void
{
parent::setUp();
ActiveRecord::$db = $this->getConnection();
}
public function provideArrayValueWithChange()
{... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
use yii\db\BatchQueryResult;
use yii\db\Query;
use yiiunit\data\ar\ActiveRecord;
use yiiunit\data\ar\Customer;
abstra... | fim | yiisoft/yii2 | php |
<?php
namespace yiiunit\framework\db;
use yii\db\ColumnSchema;
use yii\db\Schema;
use yiiunit\framework\db\stubs\IntBackedStatus;
use yiiunit\framework\db\stubs\StringBackedStatus;
use yiiunit\TestCase;
/**
* @requires PHP >= 8.1
*/
class ColumnSchemaBackedEnumTest extends TestCase
{
protected function setUp()... | fim | yiisoft/yii2 | php |
<|fim_suffix|>gth);
foreach ($calls as $call) {
$method = array_shift($call);
\call_user_func_array([$builder, $method], $call);
}
self::assertEquals($expected, $builder->__toString());
}
}
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright... | fim | yiisoft/yii2 | php |
<|fim_suffix|>=> 'array',
]);
$value = 'json_string';
$this->assertSame($value, $column->phpTypecast($value));
}
public function testEnumValuesProperty(): void
{
$column = $this->createColumn([
'type' => Schema::TYPE_STRING,
'phpType' => 'string',
... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
use PDO;
use Throwable;
use yii\base\InvalidArgumentException;
use yiiunit\framework\db\enums\Status;
use yiiunit\fram... | fim | yiisoft/yii2 | php |
<|fim_suffix|>mespace yiiunit\framework\db;
use yii\base\BaseObject;
abstract class CompareValue extends BaseObject
{
}
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copy<|fim_middle|>right Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
na<|endoftext|> | fim | yiisoft/yii2 | php |
<|fim_suffix|>;
$connection->close();
$cacheKey = ['yii\db\Connection::openFromPoolSequentially', 'host:invalid'];
$connection->masters[0]['dsn'] = 'host:invalid';
try {
$connection->open();
} catch (InvalidConfigException $e) {
}
$this->assertFalse($... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
use Exception;
use Yii;
use yii\caching\DummyCache;
use yii\db\Connection;
use yiiunit\TestCase;
abstract class Datab... | fim | yiisoft/yii2 | php |
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
use stdClass;
use yii\db\Expression;
use yii\db\ActiveQuery;
use yii\db\Query;
trait GetTablesAliasTestTrait
{
/**
* @retu... | fim | yiisoft/yii2 | php |
<|fim_prefix|><?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\db;
use yii\caching\ArrayCache;
use yii\db\Connection;
use yii\db\Expression;
use yii\db\Query;
use yii\db\Schema;
abstra... | fim | yiisoft/yii2 | php |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.