public function testCachesDescriptions() { $adapter = new DoctrineCacheAdapter(new ArrayCache()); $factory = new ServiceDescriptionFactory(); // Create a service and add it to the cache $service = $factory->build($this->jsonFile, array('cache.adapter' => $adapter)); // Ensure the cache key was set $this->assertTrue($adapter->contains('d' . crc32($this->jsonFile))); // Grab the service from the cache $this->assertEquals($service, $factory->build($this->jsonFile, array('cache.adapter' => $adapter))); }
public function testCachesArtifacts() { $jsonFile = __DIR__ . '/../TestData/test_service.json'; $adapter = new DoctrineCacheAdapter(new ArrayCache()); $factory = $this->getFactory(); $factory->expects($this->once())->method('getClassName')->will($this->returnValue('Guzzle\\Service\\Builder\\JsonServiceBuilderFactory')); // Create a service and add it to the cache $service = $factory->build($jsonFile, array('cache.adapter' => $adapter)); // Ensure the cache key was set $this->assertTrue($adapter->contains('guzzle' . crc32($jsonFile))); // Grab the service from the cache $this->assertEquals($service, $factory->build($jsonFile, array('cache.adapter' => $adapter))); }
public function testDescriptionIsCacheable() { $jsonFile = __DIR__ . '/../../TestData/test_service.json'; $adapter = new DoctrineCacheAdapter(new ArrayCache()); $builder = ServiceBuilder::factory($jsonFile, array('cache.adapter' => $adapter)); // Ensure the cache key was set $this->assertTrue($adapter->contains('guzzle' . crc32($jsonFile))); // Grab the service from the cache $this->assertEquals($builder, ServiceBuilder::factory($jsonFile, array('cache.adapter' => $adapter))); }
/** * @covers \Guzzle\Common\Cache\DoctrineCacheAdapter::delete */ public function testDelete() { $this->assertTrue($this->adapter->save('test', 'data', 1000)); $this->assertTrue($this->adapter->delete('test')); $this->assertFalse($this->adapter->contains('test')); }