text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ namespace yiiunit\framework\mail\stubs; use yii\mail\BaseMailer; /<|fim_suffix|>e) { $this->sentMessages[] = $message; return tr...
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\mail\stubs; use yii\mail\BaseMessage; /** * Test Message class. */ class TestMessage extends BaseMessage { public $...
fim
yiisoft/yii2
php
<|fim_suffix|>); } } <|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.co<|fim_middle|>m/license/ */ namespace yiiunit\framework\mail\stubs; use Exception; class TestMessageWithException extends TestMessage { ...
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\mutex; use Yii; use yii\base<|fim_suffix|>' => $connection]]); $this->assertSame($connec...
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\mutex; use Yii; use yii\base\InvalidConfigException; use yii\mutex\FileMutex; use yiiunit\TestCase; /** * Class FileM<|f...
fim
yiisoft/yii2
php
<|fim_suffix|>LockWhenAlreadyHeld(): void { $mutex = new DumbMutex(); $mutex->acquire('test'); $countBefore = count($mutex->attemptsTime); $mutex->acquire('test'); $this->assertCount($countBefore, $mutex->attemptsTime); $mutex->release('test'); } } <|fim_prefix|...
fim
yiisoft/yii2
php
<|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC *<|fim_suffix|>sAcquired($mutexName)); $this->assertTrue($mutexOne->release($mutexName)); $this->assertFalse($mutexOne->isAcquired($mutexName)); $this->assertFalse($mutexOne->isAc...
fim
yiisoft/yii2
php
<|fim_suffix|>; $this->assertInstanceOf(Expression::class, $mutex->keyPrefix); $this->assertSame('1+1', $mutex->keyPrefix->expression); } } <|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/licen...
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\mutex; use yii\base\InvalidConfigException; use yii\db\Connection; use yii\mutex\OracleMutex; use yiiunit\Test...
fim
yiisoft/yii2
php
<|fim_suffix|>b' => $this->getConnection(), ]); } } <|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ namespace yiiunit\framework\mutex; use Yii; use yii\base\InvalidConfigException; use y...
fim
yiisoft/yii2
php
<|fim_suffix|>rly taken into account. Actual interval was %s ms.', $mutexTwo->retryDelay, $attemptInterval ) ); } } } /** * @return bool */ private function isRunningOnWindows() { r...
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\mutex\mocks; use yii\mutex\Mutex; use yii\mutex\RetryAcquireTrait; /** * Class DumbMutex. * * @author Robert Korulczyk...
fim
yiisoft/yii2
php
<|fim_suffix|>ensure that serialized object * does not get corrupted after saving into the DB because of null-bytes * in the string. * * @see https://github.com/yiisoft/yii2/issues/10176 * @see https://github.com/yiisoft/yii2/issues/12681 */ private $somePrivateProperty; protected ...
fim
yiisoft/yii2
php
<|fim_prefix|><?php /** * @link https://ww<|fim_suffix|> public $reallyReally = false; /** * {@inheritdoc} */ public function execute($user, $item, $params) { return $params['authorID'] == $user; } } <|fim_middle|>w.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software...
fim
yiisoft/yii2
php
<|fim_suffix|>ic static function createConnection() { $db = new Connection(); $db->dsn = static::$database['dsn']; if (isset(static::$database['username'])) { $db->username = static::$database['username']; $db->password = static::$database['password']; } ...
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\rbac; use yii\rbac\Item; use yii\rbac\Assignment; use yii\rbac\Rule; use yii\rbac\PhpManager; /** * Exposes protected pr...
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\rbac; use Yii; use InvalidArgumentException; use yii\rbac\BaseManager; use yii\rbac\Item; use yii\rbac\Permission; use yii...
fim
yiisoft/yii2
php
<|fim_suffix|>rCacheTest extends MySQLManagerTest { /** * @return ManagerInterface */ protected function createManager() { return new DbManager([ 'db' => $this->getConnection(), 'cache' => new FileCache(['cachePath' => '@yiiunit/runtime/cache']), 'defaul...
fim
yiisoft/yii2
php
<|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copy<|fim_suffix|>ss MySQLManagerTest extends DbManagerTestCase { protected static $driverName = 'mysql'; } <|fim_middle|>right (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ namespace yiiunit\framework\r...
fim
yiisoft/yii2
php
<|fim_suffix|> * @return ManagerInterface */ protected function createManager() { return new DbManager([ 'db' => $this->getConnection(), 'cache' => new FileCache(['cachePath' => '@yiiunit/runtime/cache']), 'defaultRoles' => ['myDefaultRole'], ]); } }...
fim
yiisoft/yii2
php
<|fim_prefix|><?php /** * @link https://www.yiiframework.c<|fim_suffix|>rbac * @group pgsql */ class PgSQLManagerTest extends DbManagerTestCase { protected static $driverName = 'pgsql'; } <|fim_middle|>om/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ 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 yii\rbac; /** * Mock for the filemtime() function for rbac classes. Avoid random test fails. * @param string $file * @return int */ func...
fim
yiisoft/yii2
php
<|fim_suffix|>qliteDb; } } <|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ namespace yiiunit\framework\rbac; /** * SqliteManagerTest. * @group db * @group rbac * @group sqlite */ class Sqli...
fim
yiisoft/yii2
php
<|fim_suffix|>Size, $requirementsChecker->getByteSize($verboseValue), "Wrong byte size for '{$verboseValue}'!"); } /** * Data provider for [[testCompareByteSize()]] * @return array */ public static function dataProviderCompareByteSize(): array { return [ ['2M', '2K', ...
fim
yiisoft/yii2
php
<|fim_prefix|><?php namespace yiiunit\framework\rest; use Yii; use yii\data\ActiveDataProvider; use yii\data\Pagination; use yii\data\Sort; use yii\db\ActiveRecord; use yii\db\Query; use yii\rest\ActiveController; use yii\rest\IndexAction; use yiiunit\framework\filters\stubs\UserIdentity; use yiiunit\TestCase; /** ...
fim
yiisoft/yii2
php
<|fim_suffix|> 'pageSize' => 1, 'page' => 1, ], ]), [ 1 => ['id' => 2, 'username' => 'Tom'], ], true, ], [ new ArrayDataProvider([ ...
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\rest; use Yii; use yii\helpers\VarDumper; use yii\rest\UrlRule; use yii\web\Request; use yii\web\UrlManager; use yii\web\U...
fim
yiisoft/yii2
php
<|fim_suffix|>ataDirectory = '@app/framework/test/custom'; public function beforeLoad(): void { if ($this->db->driverName === 'sqlsrv') { $this->db->createCommand()->truncateTable('customer')->execute(); } parent::beforeLoad(); } } class AnimalFixture extends ActiveFix...
fim
yiisoft/yii2
php
<|fim_suffix|>omer1']['name'], 'first fixture data should match'); $this->assertEquals('customer2@example.com', $this->_fixture['customer2']['email'], 'second fixture data should match'); } public function testNothingToLoad(): void { $this->_fixture->dataFile = false; $this->assertE...
fim
yiisoft/yii2
php
<|fim_suffix|>ure $name"); } } } public function testLoadSequence(): void { foreach ($this->getLoadSequenceTests() as $scenario => $result) { $test = new MyTestCase(); $test->scenario = $scenario; MyTestCase::$load = ''; MyTestCase...
fim
yiisoft/yii2
php
<?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ return [ 'directory' => [ 'email' => 'directory@example.com', 'name' => 'directory name', 'address' => 'directory-address1', 'sta...
fim
yiisoft/yii2
php
<|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software <|fim_suffix|>customer2@example.com', 'name' => 'customer2', 'address' => 'address2', 'status' => 2, ], ]; <|fim_middle|>LLC * @license https://www.yiiframework.com/license/ */ re...
fim
yiisoft/yii2
php
<|fim_suffix|>m', 'name' => 'customer1', 'address' => 'address1', 'status' => 1, 'profile_id' => 1, ], 'customer2' => [ 'email' => 'customer2@example.com', 'name' => 'customer2', 'address' => 'address2', 'status' => 2, 'profile_id' => 2, ...
fim
yiisoft/yii2
php
<|fim_suffix|> 'profile1' => [ 'id' => 1, 'description' => 'profile 1', ], 'profile2' => [ 'id' => 2, 'description' => 'profile 2', ], ]; <|fim_prefix|><?p<|fim_middle|>hp /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @lice...
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\validators; use yii\validators\BooleanValidator; use yiiunit\data\validators\models\FakedValidationModel; use yiiunit\fram...
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\validators; use Exception; use yii\base\InvalidConfigException; use yii\validators\CompareValidator; use yiiunit\data\vali...
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\validators; use IntlDateFormatter; use yii\validators\DateValidator; use yiiunit\data\validators\models\FakedValidationModel; use yiiuni...
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\validators; use stdclass; use yii\validators\DefaultValueValidator; use yiiunit\TestCase; /** * @group validators */ class DefaultVal...
fim
yiisoft/yii2
php
<|fim_suffix|>r']]); $validator->validateAttribute($model, 'attr_array'); $this->assertFalse($model->hasErrors('array')); $this->assertTrue($validator->validate($model->attr_array)); } /** * @see https://github.com/yiisoft/yii2/issues/17810 * * Do not reuse model propert...
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\validators; use yii\validators\EmailValidator; use yiiunit\data\validators\models\FakedValidationModel; use yiiunit\TestCase; /** * @g...
fim
yiisoft/yii2
php
<|fim_suffix|> OrderItem::$tableName = $oldTableName; } /** * Test expresssion in targetAttribute. * @see https://github.com/yiisoft/yii2/issues/14304 */ public function testExpresionInAttributeColumnName(): void { $val = new ExistValidator([ 'targetClass' => Or...
fim
yiisoft/yii2
php
<|fim_suffix|> [ 'name' => 'text.txt', 'size' => 1024, ], ] ), ] ); $m->setScenario('validateFile'); $this->assertFalse($m->validate()); } public functio...
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\validators; use yii\validators\FilterValidator; use yiiunit\data\validators\models\FakedValidationModel; use yiiunit\frame...
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\validators; use yii\validators\IpValidator; use yiiunit\data\validators\models\FakedValidationModel; use yiiunit\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\validators; use stdClass; use yii\validators\NumberValidator; use yii\web\View; use yiiunit\data\validators\models\FakedVa...
fim
yiisoft/yii2
php
<|fim_suffix|>estInitException(): void { $this->expectException('yii\base\InvalidConfigException'); $this->expectExceptionMessage('The "range" property must be set.'); new RangeValidator(['range' => 'not an array']); } public function testAssureMessageSetOnInit(): void { ...
fim
yiisoft/yii2
php
<|fim_suffix|>'skipOnEmpty']); } } <|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ namespace yiiunit\framework\validators; use yii\validators\RegularExpressionValidator; use yiiunit\data\validat...
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\validators; use yii\validators\RequiredValidator; use yiiunit\data\validators\models\FakedValidationModel; use yiiunit\fra...
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\validators; use yii\base\DynamicModel; use yii\validators\SafeValidator; use yiiunit\TestCase; /** * @group validators */ class SafeV...
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\validators; use stdClass; use yii\validators\StringValidator; use yiiunit\data\validators\models\FakedValidationModel; use...
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\validators; use yii\base\DynamicModel; use yii\helpers\Json; use yii\validators\TrimValidator; use yii\web\View; use yii<|...
fim
yiisoft/yii2
php
<|fim_suffix|>nName('val_attr_c')}=:qp1)"; $this->assertEquals($expected, $query->createCommand()->getSql()); $params = ['val_attr_b' => 'test value b']; $query = $this->invokeMethod(new UniqueValidator(['filter' => 'val_attr_a > 0']), 'prepareQuery', [$model, $params]); $expected = "SE...
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\validators; use yii\validators\UrlValidator; use yiiunit\data\validators\models\FakedValidationModel; use yiiunit\TestCase...
fim
yiisoft/yii2
php
<|fim_suffix|> $validator->enableErrorOnValidateAttribute(); $validator->attributes = ['email1']; $model->getValidators()->append($validator); $this->assertFalse($model->validate()); $validator->attributes = ['email2']; $model->getValidators()->append($validator); $this...
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\validators\stubs; use yii\base\Model; class ModelForReqValidator extends Model { public $attr; public function r...
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\validators\stubs; use yii\web\View; class ViewStub extends View { public function registerAssetBundle($name, $position = null) ...
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\web; use yiiunit\TestCase; use Exception; use yii\base\InvalidConfigException; use Yii; use yii\helpers\FileHelper; 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\web; use yiiunit\TestCase; use Yii; use yii\helpers\FileHelper; use yii\web\AssetConverter; /** * @group web */ class A...
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\web; use yii\web\Application; use yiiunit\framework\web\stubs\ModelBindingStub; use yii\base\Module; use yii\data\ArrayDat...
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\web; use DateTime; use DateTimeImmutable; use yii\web\Cookie; use yii\web\CookieCollection; use yiiunit\TestCase; /** * ...
fim
yiisoft/yii2
php
<|fim_suffix|>pp->getErrorHandler()->exception = new InvalidArgumentException('This message will not be shown to the user'); $controller = $this->getController([ 'defaultName' => 'Oops...', 'defaultMessage' => 'The system is drunk', ]); $this->assertEquals('Name: Oops.....
fim
yiisoft/yii2
php
<|fim_suffix|>tring(Yii::$app->response->data)); $this->assertStringContainsString( "Exception 'Exception' with message 'Test Exception'", Yii::$app->response->data ); } public function testFormatXml(): void { Yii::$app->response->format = \yii\web\Response::...
fim
yiisoft/yii2
php
<|fim_suffix|>d * @param string $json the expected JSON body * @dataProvider formatTraversableObjectDataProvider */ public function testFormatTraversableObjects($data, $json): void { $this->response->data = $data; $this->formatter->format($this->response); $this->assertEqu...
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\web; use yii\web\GroupUrlRule; use yii\web\Request; use yii\web\UrlManager; use yii\web\UrlRule; use yiiunit\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\web; use yii\web\HeaderCollection; use yiiunit\TestCase; /** * @group web */ class HeaderCollectionTest extends TestCas...
fim
yiisoft/yii2
php
<|fim_suffix|>tion/xhtml+xml; charset=UTF-8', $this->response->getHeaders()->get('Content-Type') ); } public function testCopiesDataToContent(): void { $formatter = new HtmlResponseFormatter(); $this->response->data = '<h1>Hello</h1>'; $formatter->format($this->r...
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\web; use SplStack; use yii\helpers\Json; use yii\web\JsonResponseFormatter; use yiiunit\framework\web\stubs\ModelStub; /*...
fim
yiisoft/yii2
php
<|fim_suffix|>LinkTest extends TestCase { public function testSerializeLinkInSimpleArrayWillRemoveNotSetValues(): void { $managerLink = new Link([ 'href' => 'https://example.com/users/4', 'name' => 'User 4', 'title' => 'My Manager', ]); $expected = [ ...
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\web; use yii\web\MultipartFormDataParser; use yiiunit\TestCase; class Multipart<|fim_suffix|>undary; $rawBody = "...
fim
yiisoft/yii2
php
<|fim_suffix|> * @inheritdoc */ class Post extends BaseObject { /** * @var int */ public $id; /** * @var string */ public $title; /** * @param int $id * @param string $title * @param array $config */ public function __construct($id, $title, $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\web; use Yii; use yii\base\InvalidConfigException; use stdClass; use yii\web\Request; use yiiunit\TestCase; /** * @group web * @backu...
fim
yiisoft/yii2
php
<|fim_suffix|>f (strpos($header, 'Set-Cookie: ') !== 0) { continue; } $name = null; $params = []; $pairs = explode(';', substr($header, 12)); foreach ($pairs as $index => $pair) { $pair = trim($pair); if (strpos...
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\web; use yii\web\UploadedFile; use yiiunit\f<|fim_suffix|> } // Tests : public function testGetInstance(): voi...
fim
yiisoft/yii2
php
<|fim_suffix|>thod(['post/view', 'id' => 1, 'title' => 'sample post', '#' => 'testhash']); $this->assertEquals("$prefix/post/view/?id=1&title=sample+post#testhash", $url); // with defaultAction $url = $manager->$method(['/post', 'page' => 1]); $this->assertEquals("$prefix/post/?page=1",...
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\web; use yii\web\Application; use yii\caching\ArrayCache; use yii\web\Request; use yii\web\UrlManager; use yiiunit\TestCas...
fim
yiisoft/yii2
php
<|fim_suffix|>]); $request = new Request(); // default setting without 'r' param $request->setQueryParams([]); $result = $manager->parseRequest($request); $this->assertEquals(['', []], $result); // default setting with 'r' param $request->setQueryParams([$routeP...
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\web; use Yii; use yii\web\NotFoundHttpException; use yii\web\Request; use yii\web\UrlManager; use yii\web\UrlNormalizer; use yii\web\Url...
fim
yiisoft/yii2
php
<|fim_suffix|> [ 'optional param at the beginning with suffix', [ 'pattern' => '<page>', 'route' => 'page/view', 'defaults' => ['page' => 'index'], 'suffix' => '/', ], ...
fim
yiisoft/yii2
php
<|fim_prefix|><?php namespace yiiunit\framework\web; use yii\base\Component; use yii\base\NotSupportedException; use yii\web\IdentityInterface; class UserIdentity extends Component implements IdentityInterface { private static $ids = [ 'user1', 'user2', 'user3', ]; private $_id; ...
fim
yiisoft/yii2
php
<|fim_suffix|> $this->assertFalse(Yii::$app->response->getIsRedirection()); $this->assertSame($id, Yii::$app->session->id); $this->reset(); Yii::$app->request->setUrl('accept-html-json'); $_SERVER['HTTP_ACCEPT'] = 'text/json; q=1, text/html; q=0.1'; $user->loginRequired(...
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\web; use Yii; use yii\caching\FileCache; use yii\web\View; use yiiunit\TestCase; /** * @group web */ class ViewTest ext...
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\web; use SplStack; use yii\web\XmlResponseFormatter; use yiiunit\framework\web\stubs\ModelStub; /** * @author Qiang Xue ...
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\web\mocks; use yii\web\Request; class TestRequestComponent extends Request { /** * @var bool|null override getIs...
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\web\session; use PDO; use Exception; use stdClass; use Yii; use yii\db\Connection; use yii\db\Migration; use yii\db\Query;...
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\web\session; use yiiunit\TestCase; use Yii; use yii\caching\FileCache; use yii\web\CacheSession; /** * @group web */ cl...
fim
yiisoft/yii2
php
<|fim_suffix|> * Test to prove that after Session::destroy session id set to old value. */ public function testDestroySessionId(): void { $session = new Session(); $session->open(); $oldSessionId = @session_id(); $this->assertNotEmpty($oldSessionId); $session->...
fim
yiisoft/yii2
php
<|fim_prefix|><?php namespace yiiunit\framework\web\session; use yii\web\Session; trait SessionTestTrait { public function initStrictModeTest($class): void { /** @var Session $session */ $session = new $class(); $session->useStrictMode = false; $this->assertEquals(false, $ses...
fim
yiisoft/yii2
php
<|fim_suffix|> // I failed to make it work either with `nvarchar(max)` or `varbinary(max)` column // in Microsoft SQL server. ยฉ SilverFire TODO: fix it return $object; } } <|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license...
fim
yiisoft/yii2
php
<|fim_suffix|>getDriverNames() { return ['mysql']; } } <|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ namespace yiiunit\framework\web\session\mysql; use yiiunit\framework\web\sessio...
fim
yiisoft/yii2
php
<|fim_suffix|> { if (defined('HHVM_VERSION')) { $this->markTestSkipped('HHVMs PgSQL implementation does not seem to support blob columns in the way they are used here.'); } parent::setUp(); } protected function getDriverNames() { return ['pgsql']; } } <|fi...
fim
yiisoft/yii2
php
<|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 200<|fim_suffix|>C * @license https://www.yiiframework.com/license/ */ namespace yiiunit\framework\web\session\sqlite; use yiiunit\framework\web\session\AbstractDbSessionTest; use Yii; /** * Class DbSessionTest. * * @aut...
fim
yiisoft/yii2
php
<|fim_suffix|>/license/ */ namespace yiiunit\framework\web\stubs; use yii\web\UrlRule; class CachedUrlRule extends UrlRule { public $createCounter = 0; public function createUrl($manager, $route, $params) { $this->createCounter++; return parent::createUrl($manager, $route, $params); ...
fim
yiisoft/yii2
php
<|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/lic<|fim_suffix|>$other = 'default') { } } <|fim_middle|>ense/ */ namespace yiiunit\framework\web\stubs; use yii\web\Controller; /** * @author Misbahul ...
fim
yiisoft/yii2
php
<|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright <|fim_suffix|>ction(DataProviderInterface $dataProvider) { } public function actionModelBindingInjection(ModelBindingStub $model) { } } <|fim_middle|>Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframewor...
fim
yiisoft/yii2
php
<|fim_prefix|><?php /** * @link https:/<|fim_suffix|>anodn@craftcms.com> * @since 2.0.31 */ class FakePhp7Controller extends Controller { public $enableCsrfValidation = false; public function actionAksi1(int $foo, ?float $bar, bool $true, bool $false, string $string) { } public function action...
fim
yiisoft/yii2
php
<|fim_suffix|>ic function actionInjection(int|string $arg, int|string $second) { } public function actionArrayOrInt(array|int $foo) { } } <|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiif<|fim_middle|>ramew...
fim
yiisoft/yii2
php
<|fim_prefix|><?php namespace yiiunit\framework\web\stubs; use yii\db\ActiveRecord; use yii\web\NotFoundHttpException; class Mode<|fim_suffix|>; } } <|fim_middle|>lBindingStub extends ActiveRecord { /** * @return self * @throws NotFoundHttpException */ public static function build() { ...
fim
yiisoft/yii2
php
<|fim_suffix|>namespace yiiunit\framework\web\stubs; use yii\base\Model; class ModelStub extends Model { public $id; public $title; public $hidden; public function toArray(array $fields = [], array $expand = [], $recursive = true) { return ['id' => $this->id, 'title' => $this->title]; ...
fim
yiisoft/yii2
php
<|fim_suffix|>@license https://www.yiiframework.com/license/ */ namespace yiiunit\framework\web\stubs; use yii\web\UploadedFile; class VendorImage extends UploadedFile { } <|fim_prefix|><?php /** * @link https://www.yiiframework.com/ * @copyrigh<|fim_middle|>t Copyright (c) 2008 Yii Software LLC * <|endoftext|>
fim
yiisoft/yii2
php
<|fim_suffix|>Field->attribute = '[0]' . $this->attributeName; $this->activeField->addAriaAttributes = true; $expectedValue = <<<'EOD' <div class="form-group field-activefieldtestmodel-0-attributename"> <label class="control-label" for="activefieldtestmodel-0-attributename">Attribute Name</label> <inpu...
fim
yiisoft/yii2
php