aboutsummaryrefslogtreecommitdiffstats
path: root/public/system/storage/vendor/guzzlehttp/ringphp/tests/Future/CompletedFutureArrayTest.php
blob: 82d7efbf5caa958a54c786efc9a0fa572e4b3f21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
namespace GuzzleHttp\Tests\Ring\Future;

use GuzzleHttp\Ring\Future\CompletedFutureArray;

class CompletedFutureArrayTest extends \PHPUnit_Framework_TestCase
{
    public function testReturnsAsArray()
    {
        $f = new CompletedFutureArray(['foo' => 'bar']);
        $this->assertEquals('bar', $f['foo']);
        $this->assertFalse(isset($f['baz']));
        $f['abc'] = '123';
        $this->assertTrue(isset($f['abc']));
        $this->assertEquals(['foo' => 'bar', 'abc' => '123'], iterator_to_array($f));
        $this->assertEquals(2, count($f));
        unset($f['abc']);
        $this->assertEquals(1, count($f));
        $this->assertEquals(['foo' => 'bar'], iterator_to_array($f));
    }
}