mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Fixed regexp in tests
This commit is contained in:
52
framework/db/mysql/ColumnSchema.php
Normal file
52
framework/db/mysql/ColumnSchema.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||
* @license http://www.yiiframework.com/license/
|
||||
*/
|
||||
|
||||
namespace yii\db\mysql;
|
||||
|
||||
use yii\db\ExpressionInterface;
|
||||
use yii\db\JsonExpression;
|
||||
|
||||
/**
|
||||
* Class ColumnSchema
|
||||
*
|
||||
* @author Dmytro Naumenko <d.naumenko.a@gmail.com>
|
||||
* @since 2.0.14.1
|
||||
*/
|
||||
class ColumnSchema extends \yii\db\ColumnSchema
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dbTypecast($value)
|
||||
{
|
||||
if ($value instanceof ExpressionInterface) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ($this->dbType === Schema::TYPE_JSON) {
|
||||
return new JsonExpression($value, $this->type);
|
||||
}
|
||||
|
||||
return $this->typecast($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function phpTypecast($value)
|
||||
{
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->type === Schema::TYPE_JSON) {
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
return parent::phpTypecast($value);
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ namespace yiiunit\data\ar;
|
||||
* @property string $title
|
||||
* @property string $content
|
||||
* @property int $version
|
||||
* @property array $document
|
||||
*/
|
||||
class Document extends ActiveRecord
|
||||
{
|
||||
|
@ -169,6 +169,7 @@ CREATE TABLE `document` (
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`content` TEXT,
|
||||
`version` INT(11) NOT NULL DEFAULT 0,
|
||||
`properties` JSON,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -178,7 +178,8 @@ CREATE TABLE "document" (
|
||||
id serial primary key,
|
||||
title varchar(255) not null,
|
||||
content text not null,
|
||||
version integer not null default 0
|
||||
version integer not null default 0,
|
||||
properties json
|
||||
);
|
||||
|
||||
CREATE TABLE "comment" (
|
||||
|
@ -54,6 +54,6 @@ class ChangeLogTest extends TestCase
|
||||
* - Description ends without a "."
|
||||
* - Line ends with contributor name between "(" and ")".
|
||||
*/
|
||||
$this->assertRegExp('/- (Bug|Enh|Chg|New)( #\d+(, #\d+)*)?(\s\(CVE-[\d-]+\))?: .*[^.] \(.*\)$', $line);
|
||||
$this->assertRegExp('/- (Bug|Enh|Chg|New)( #\d+(, #\d+)*)?(\s\(CVE-[\d-]+\))?: .*[^.] \(.*\)$/', $line);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user