Jamm\Memory\Tests\TestMemoryObject::test_read PHP Метод

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

public test_read ( )
    public function test_read()
    {
        //Read 10
        $this->mem->save(__METHOD__ . 't1', 10);
        $this->assertEquals($this->mem->read(__METHOD__ . 't1'), 10);
        //Read float key
        $key = microtime(true) * 100;
        $this->mem->save($key, 10);
        $this->assertEquals($this->mem->read($key), 10);
        //Read negative float
        $key = -10.987;
        $this->mem->save($key, 10);
        $this->assertEquals($this->mem->read($key), 10);
        //Read string
        $this->mem->save(__METHOD__ . 't1', 'string', 10);
        $this->assertEquals($this->mem->read(__METHOD__ . 't1'), 'string');
        //Read and check ttl
        $call = $this->mem->read(__METHOD__ . 't1', $ttl_left);
        $this->assertEquals($call, 'string');
        $this->assertEquals($ttl_left, 10)->addCommentary('ttl');
        //Read array and check ttl
        $this->mem->save(__METHOD__ . 't11', array(10, 'string'), 100);
        $call = $this->mem->read(__METHOD__ . 't11', $ttl_left);
        $this->assertEquals($call, array(10, 'string'));
        $this->assertEquals($ttl_left, 100)->addCommentary('ttl');
    }