]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/front/ShaarliMiddlewareTest.php
Process Shaarli install through Slim controller
[github/shaarli/Shaarli.git] / tests / front / ShaarliMiddlewareTest.php
index 81ea134409ffdd8e9f03d4dff90da8c4f1bebde6..20090d8b0a9720c0e8c6e9f1c91905f3533959be 100644 (file)
@@ -19,6 +19,8 @@ use Slim\Http\Uri;
 
 class ShaarliMiddlewareTest extends TestCase
 {
+    protected const TMP_MOCK_FILE = '.tmp';
+
     /** @var ShaarliContainer */
     protected $container;
 
@@ -29,12 +31,21 @@ class ShaarliMiddlewareTest extends TestCase
     {
         $this->container = $this->createMock(ShaarliContainer::class);
 
+        touch(static::TMP_MOCK_FILE);
+
         $this->container->conf = $this->createMock(ConfigManager::class);
+        $this->container->conf->method('getConfigFileExt')->willReturn(static::TMP_MOCK_FILE);
+
         $this->container->loginManager = $this->createMock(LoginManager::class);
 
         $this->middleware = new ShaarliMiddleware($this->container);
     }
 
+    public function tearDown()
+    {
+        unlink(static::TMP_MOCK_FILE);
+    }
+
     /**
      * Test middleware execution with valid controller call
      */
@@ -179,6 +190,7 @@ class ShaarliMiddlewareTest extends TestCase
         $this->container->conf->method('get')->willReturnCallback(function (string $key): string {
             return $key;
         });
+        $this->container->conf->method('getConfigFileExt')->willReturn(static::TMP_MOCK_FILE);
 
         $this->container->pageCacheManager = $this->createMock(PageCacheManager::class);
         $this->container->pageCacheManager->expects(static::once())->method('invalidateCaches');