write() public method

public write ( $key, $content, array $metadata = null )
$metadata array
 /**
  * @test
  */
 public function shouldNotWriteToFallbackOnFillOnMiss()
 {
     $key = "test-file";
     $contents = "abc123";
     $this->readthroughAdapter = new ReadthroughAdapter($this->primary, $this->fallback, true);
     $this->fallback->write($key, $contents);
     $this->readthroughAdapter->read($key);
     $this->assertTrue($this->primary->exists($key), "primary should not have copy of read file");
     $this->assertEquals($contents, $this->primary->read($key), "primary file should match fallback file");
 }
Beispiel #2
0
 public function testLastModifiedTimeIsUpdatedOnWrite()
 {
     $adapter = new InMemory(array('foobar' => array('content' => 'Some content', 'mtime' => 123456789)));
     $time = time();
     $adapter->write('foobar', 'Changed content');
     $this->assertTrue(in_array($adapter->mtime('foobar'), array($time, $time + 1)));
 }
Beispiel #3
0
 /**
  * @dataProvider providerTestContainer
  */
 public function testContainer($service, $expected)
 {
     $adapter = new InMemory();
     $adapter->write(Application::DEFAULT_MASTER_FILE, null);
     $app = new Application();
     $app['configuration.fileSystem.adapter'] = $adapter;
     $this->assertInstanceOf($expected, $app[$service]);
 }