factory = new StreamFactory(); } protected function tearDown(): void { parent::tearDown(); // phpcs:disable @unlink($this->filename); // phpcs:enable } public function testCreateStream(): void { $stream = $this->factory->createStream('test'); $this->assertSame('test', $stream->getContents()); } public function testCreateStreamFile(): void { file_put_contents($this->filename, 'it works'); $stream = $this->factory->createStreamFromFile($this->filename); $this->assertSame('it works', $stream->getContents()); } public function testCreateStreamResource(): void { file_put_contents($this->filename, 'it works'); $resource = fopen($this->filename, 'r'); $stream = $this->factory->createStreamFromResource($resource); $this->assertSame('it works', $stream->getContents()); fclose($resource); } }