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\caching; use PHPUnit\Framework\TestCase; use yii\cachi..

Decoded Output download

<?php

namespace yiiunitramework\caching;

use PHPUnit\Framework\TestCase;
use yii\caching\ArrayCache;
use yii\caching\CallbackDependency;

class CallbackDependencyTest extends TestCase
{
    public function testDependencyChange()
    {
        $cache = new ArrayCache();
        $dependencyValue = true;

        $dependency = new CallbackDependency();
        $dependency->callback = function () use (&$dependencyValue) {
            return $dependencyValue === true;
        };

        $dependency->evaluateDependency($cache);
        $this->assertFalse($dependency->isChanged($cache));

        $dependencyValue = false;
        $this->assertTrue($dependency->isChanged($cache));
    }

    public function testDependencyNotChanged()
    {
        $cache = new ArrayCache();

        $dependency = new CallbackDependency();
        $dependency->callback = function () {
            return 2 + 2;
        };

        $dependency->evaluateDependency($cache);
        $this->assertFalse($dependency->isChanged($cache));
        $this->assertFalse($dependency->isChanged($cache));
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace yiiunit\framework\caching;

use PHPUnit\Framework\TestCase;
use yii\caching\ArrayCache;
use yii\caching\CallbackDependency;

class CallbackDependencyTest extends TestCase
{
    public function testDependencyChange()
    {
        $cache = new ArrayCache();
        $dependencyValue = true;

        $dependency = new CallbackDependency();
        $dependency->callback = function () use (&$dependencyValue) {
            return $dependencyValue === true;
        };

        $dependency->evaluateDependency($cache);
        $this->assertFalse($dependency->isChanged($cache));

        $dependencyValue = false;
        $this->assertTrue($dependency->isChanged($cache));
    }

    public function testDependencyNotChanged()
    {
        $cache = new ArrayCache();

        $dependency = new CallbackDependency();
        $dependency->callback = function () {
            return 2 + 2;
        };

        $dependency->evaluateDependency($cache);
        $this->assertFalse($dependency->isChanged($cache));
        $this->assertFalse($dependency->isChanged($cache));
    }
}

Function Calls

None

Variables

None

Stats

MD5 f3e673fb27018ff5b8c7750bd25e9195
Eval Count 0
Decode Time 119 ms