Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace yiiunit\framework\db\pgsql; use yii\db\JsonExpression; use yiiunit\data\..

Decoded Output download

<?php

namespace yiiunitramework\db\pgsql;

use yii\db\JsonExpression;
use yiiunit\datar\ActiveRecord;

/**
 * @group db
 * @group pgsql
 */
class BaseActiveRecordTest extends \yiiunitramework\db\BaseActiveRecordTest
{
    public $driverName = 'pgsql';

    /**
     * @see https://github.com/yiisoft/yii2/issues/19872
     *
     * @dataProvider provideArrayValueWithChange
     */
    public function testJsonDirtyAttributesWithDataChange($actual, $modified)
    {
        $createdStorage = new ArrayAndJsonType([
            'json_col' => new JsonExpression($actual),
        ]);

        $createdStorage->save();

        $foundStorage = ArrayAndJsonType::find()->limit(1)->one();

        $this->assertNotNull($foundStorage);

        $foundStorage->json_col = $modified;

        $this->assertSame(['json_col' => $modified], $foundStorage->getDirtyAttributes());
    }
}

/**
 * {@inheritdoc}
 * @property array id
 * @property array json_col
 */
class ArrayAndJsonType extends ActiveRecord
{
    public static function tableName()
    {
        return '{{%array_and_json_types}}';
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace yiiunit\framework\db\pgsql;

use yii\db\JsonExpression;
use yiiunit\data\ar\ActiveRecord;

/**
 * @group db
 * @group pgsql
 */
class BaseActiveRecordTest extends \yiiunit\framework\db\BaseActiveRecordTest
{
    public $driverName = 'pgsql';

    /**
     * @see https://github.com/yiisoft/yii2/issues/19872
     *
     * @dataProvider provideArrayValueWithChange
     */
    public function testJsonDirtyAttributesWithDataChange($actual, $modified)
    {
        $createdStorage = new ArrayAndJsonType([
            'json_col' => new JsonExpression($actual),
        ]);

        $createdStorage->save();

        $foundStorage = ArrayAndJsonType::find()->limit(1)->one();

        $this->assertNotNull($foundStorage);

        $foundStorage->json_col = $modified;

        $this->assertSame(['json_col' => $modified], $foundStorage->getDirtyAttributes());
    }
}

/**
 * {@inheritdoc}
 * @property array id
 * @property array json_col
 */
class ArrayAndJsonType extends ActiveRecord
{
    public static function tableName()
    {
        return '{{%array_and_json_types}}';
    }
}

Function Calls

None

Variables

None

Stats

MD5 15628aa725f00dc0698ae971aa36e67c
Eval Count 0
Decode Time 100 ms