lithium\tests\cases\storage\session\adapter\PhpTest::testRead PHP Метод

testRead() публичный Метод

public testRead ( )
    public function testRead()
    {
        $this->php->read();
        $key = 'read_test';
        $value = 'value to be read';
        $_SESSION[$key] = $value;
        $closure = $this->php->read($key);
        $this->assertInternalType('callable', $closure);
        $params = compact('key');
        $result = $closure($this->php, $params, null);
        $this->assertIdentical($value, $result);
        $key = 'non-existent';
        $closure = $this->php->read($key);
        $this->assertInternalType('callable', $closure);
        $params = compact('key');
        $result = $closure($this->php, $params, null);
        $this->assertNull($result);
        $closure = $this->php->read();
        $this->assertInternalType('callable', $closure);
        $result = $closure($this->php, array('key' => null), null);
        $expected = array('read_test' => 'value to be read');
        $this->assertEqual($expected, $result);
    }