public function testGenerator() { $d = new Directory('foo', (function () { (yield new File('foo', new StringStream('foo'))); (yield new File('bar', new StringStream('bar'))); (yield new File('foobar', new StringStream('foobar'))); (yield new Directory('sub')); })()); $this->assertSame(4, $d->count()); $this->assertSame('foo', (string) $d->key()); $this->assertSame('foo' . "\n" . 'bar' . "\n" . 'foobar' . "\n" . 'sub', (string) $d->content()); }