public function testAll() { $adapter = new MemoryAdapter(); $adapter->add($foo = new File('foo', new StringStream('foo'))); $adapter->add($bar = new File('bar', new StringStream('bar'))); $all = $adapter->all(); $this->assertInstanceOf(MapInterface::class, $all); $this->assertSame('string', (string) $all->keyType()); $this->assertSame(FileInterface::class, (string) $all->valueType()); $this->assertSame(['foo', 'bar'], $all->keys()->toPrimitive()); $this->assertSame([$foo, $bar], $all->values()->toPrimitive()); }
public function testAll() { $memory = new MemoryAdapter(); $lazy = new LazyAdapter($memory); $memory->add(new File('foo', new StringStream(''))); $lazy->remove('foo'); $lazy->add($bar = new File('bar', new StringStream(''))); $all = $lazy->all(); $this->assertInstanceOf(MapInterface::class, $all); $this->assertSame('string', (string) $all->keyType()); $this->assertSame(FileInterface::class, (string) $all->valueType()); $this->assertCount(1, $all); $this->assertSame($bar, $all->get('bar')); }