]> git.agnieray.net Git - galette.git/commitdiff
Improve Release unit tests
authorJohan Cwiklinski <johan@x-tnd.be>
Mon, 25 Mar 2024 15:04:39 +0000 (16:04 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Mon, 25 Mar 2024 15:04:39 +0000 (16:04 +0100)
galette/lib/Galette/Features/Cacheable.php
tests/Galette/Util/tests/units/Release.php

index 4b9cbc6cc1a6407882c8071b9b072c96a3f60b00..d58201cea0f8296d4a49a73ef9f5852ca6f71fb8 100644 (file)
@@ -46,7 +46,6 @@ trait Cacheable
      */
     protected function handleCache(bool $nocache = false): void
     {
-        $this->nocache = $nocache;
         if ($nocache === false && !Galette::isDebugEnabled()) {
             if (!$this->checkCache()) {
                 $this->makeCache();
index cfee7d444610eff4671aa0ea6b78ba24fe6ddadd..a8212d643279bd0af5094bfd13417953df3d0026 100644 (file)
@@ -59,11 +59,13 @@ class Release extends TestCase
     public function testNewRelease(string $current, string $latest, bool $expected): void
     {
         $release = $this->getMockBuilder(\Galette\Util\Release::class)
-            ->onlyMethods(array('getCurrentRelease', 'getLatestRelease'))
+            ->setConstructorArgs([true])
+            ->onlyMethods(array('getCurrentRelease', 'getLatestRelease', 'findLatestRelease'))
             ->getMock();
 
         $release->method('getCurrentRelease')->willReturn($current);
         $release->method('getLatestRelease')->willReturn($latest);
+        $release->method('findLatestRelease')->willReturn($latest);
 
         $this->assertSame($expected, $release->checkNewRelease());
     }