/** * @covers mychaelstyle\storage\File::__construct * @covers mychaelstyle\storage\File::open * @covers mychaelstyle\storage\File::write * @covers mychaelstyle\storage\File::isOpened * @covers mychaelstyle\storage\File::checkOpen * @covers mychaelstyle\storage\File::close * @covers mychaelstyle\storage\File::commit * @covers mychaelstyle\storage\File::clean * @covers mychaelstyle\storage\File::initialize * @covers mychaelstyle\storage\Storage::commit * @covers mychaelstyle\storage\File::remove * @covers mychaelstyle\storage\File::getContents */ public function testWriteWithTransaction() { // remove first $this->object->remove(); // create new storage without transaction $this->storage = new \mychaelstyle\Storage($this->dsn, $this->options, false); $this->object = $this->storage->createFile($this->uri, $this->options, false); // none transaxtion $expected = $this->test_string; $this->object->open('w'); $this->object->write($expected); $this->object->close(); $localPath = $this->getLocalPathUsingUri($this->dsn, $this->uri); $this->assertFalse(file_exists($localPath)); $this->object->commit(); $this->assertTrue(file_exists($localPath)); $this->assertLocalWritten($this->dsn, $expected, $this->uri); // get contents $result = $this->object->getContents(); $this->assertEquals($expected, $result); // remove finaly $this->object->remove(); }