diff --git a/.travis.yml b/.travis.yml
index 7228ea33..9b45484a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,22 +14,18 @@ cache:
env:
matrix:
- - SYMFONY_VERSION=3.1.*
+ - SYMFONY_VERSION=2.8.*
global:
- SYMFONY_DEPRECATIONS_HELPER=weak
matrix:
include:
- php: 7.0
- env: DEPS=dev SYMFONY_VERSION=3.2.*
+ env: DEPS=dev SYMFONY_VERSION=3.1.*
- php: 5.5
env: COMPOSER_FLAGS="--prefer-lowest"
- - php: 7.0
- env: SYMFONY_VERSION=2.8.*
- php: 7.0
env: DEPS=dev COMPOSER_FLAGS="--prefer-stable" SYMFONY_VERSION=3.0.*
- - php: 7.0
- env: DEPS=dev COMPOSER_FLAGS="--prefer-stable" SYMFONY_VERSION=3.1.*
fast_finish: true
before_install:
diff --git a/Resources/config/loaders.xml b/Resources/config/loaders.xml
index e6610018..2fa6d383 100644
--- a/Resources/config/loaders.xml
+++ b/Resources/config/loaders.xml
@@ -18,13 +18,14 @@
+
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index 56332cbc..87c1b0a9 100644
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -27,7 +27,11 @@
-
+
+ cmf_seo
+
+
+
diff --git a/Tests/Unit/Loader/BaseAnnotationLoaderTest.php b/Tests/Unit/Loader/BaseAnnotationLoaderTest.php
index 177571a7..ec8d4705 100644
--- a/Tests/Unit/Loader/BaseAnnotationLoaderTest.php
+++ b/Tests/Unit/Loader/BaseAnnotationLoaderTest.php
@@ -100,4 +100,80 @@ public function testExtrasAnnotationWithScalar()
$this->loader->load($content);
}
+
+ public function testCaching()
+ {
+ // promises
+ $annotations = $this->getMockBuilder('Symfony\Cmf\Bundle\SeoBundle\Cache\CachedCollection')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $annotations
+ ->expects($this->any())
+ ->method('isFresh')
+ ->will($this->returnValue(true))
+ ;
+ $annotations
+ ->expects($this->any())
+ ->method('getData')
+ ->will($this->returnValue(['properties' => [], 'methods' => []]))
+ ;
+ $cacheItemNoHit = $this->getMock('Psr\Cache\CacheItemInterface');
+ $cacheItemNoHit->expects($this->any())->method('isHit')->will($this->returnValue(false));
+ $cacheItemNoHit->expects($this->any())->method('get')->will($this->returnValue($annotations));
+ $cacheItemHit = $this->getMock('Psr\Cache\CacheItemInterface');
+ $cacheItemHit->expects($this->any())->method('isHit')->will($this->returnValue(true));
+ $cacheItemHit->expects($this->any())->method('get')->will($this->returnValue($annotations));
+ $cache = $this->getMock('Psr\Cache\CacheItemPoolInterface');
+ $cache
+ ->expects($this->any())
+ ->method('getItem')
+ ->will($this->onConsecutiveCalls($cacheItemNoHit, $cacheItemHit))
+ ;
+ $loader = new AnnotationLoader(new AnnotationReader(), $cache);
+
+ // predictions
+ $cache
+ ->expects($this->once())
+ ->method('save')
+ ;
+
+ $loader->load($this->getContent());
+ $loader->load($this->getContent());
+ }
+
+ public function testCacheRefresh()
+ {
+ // promises
+ $annotations = $this->getMockBuilder('Symfony\Cmf\Bundle\SeoBundle\Cache\CachedCollection')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $annotations
+ ->expects($this->any())
+ ->method('isFresh')
+ ->will($this->returnValue(false))
+ ;
+ $annotations
+ ->expects($this->any())
+ ->method('getData')
+ ->will($this->returnValue(['properties' => [], 'methods' => []]))
+ ;
+ $cacheItem = $this->getMock('Psr\Cache\CacheItemInterface');
+ $cacheItem->expects($this->any())->method('isHit')->will($this->returnValue(true));
+ $cacheItem->expects($this->any())->method('get')->will($this->returnValue($annotations));
+ $cache = $this->getMock('Psr\Cache\CacheItemPoolInterface');
+ $cache
+ ->expects($this->any())
+ ->method('getItem')
+ ->will($this->returnValue($cacheItem))
+ ;
+ $loader = new AnnotationLoader(new AnnotationReader(), $cache);
+
+ // predictions
+ $cache
+ ->expects($this->once())
+ ->method('save')
+ ;
+
+ $loader->load($this->getContent());
+ }
}
diff --git a/Tests/Unit/SeoPresentationTest.php b/Tests/Unit/SeoPresentationTest.php
index a1d19512..5f03b3fe 100644
--- a/Tests/Unit/SeoPresentationTest.php
+++ b/Tests/Unit/SeoPresentationTest.php
@@ -197,24 +197,4 @@ public function testRedirect()
$this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $redirect);
$this->assertEquals('/redirect/target', $redirect->getTargetUrl());
}
-
- public function testSeoAwareWithoutCurrentMetadata()
- {
- $content = $this->getMock('Symfony\Cmf\Bundle\SeoBundle\Tests\Resources\Document\SeoAwareContent');
- $content
- ->expects($this->any())
- ->method('getSeoMetadata')
- ->will($this->returnValue(null))
- ;
-
- $content
- ->expects($this->once())
- ->method('setSeoMetadata')
- ->with($this->callback(function ($c) {
- return $c instanceof SeoMetadataInterface;
- }))
- ;
-
- $this->seoPresentation->updateSeoPage($content);
- }
}