Bladeren bron

:octocat: $returnResource coverage

codemasher 5 jaren geleden
bovenliggende
commit
d89693a27a
3 gewijzigde bestanden met toevoegingen van 31 en 0 verwijderingen
  1. 7 0
      tests/Output/QRFpdfTest.php
  2. 15 0
      tests/Output/QRImageTest.php
  3. 9 0
      tests/Output/QRImagickTest.php

+ 7 - 0
tests/Output/QRFpdfTest.php

@@ -87,4 +87,11 @@ class QRFpdfTest extends QROutputTestAbstract{
 		$this::assertSame($expected, $actual);
 	}
 
+	public function testOutputGetResource():void{
+		$this->options->returnResource = true;
+		$this->outputInterface         = $this->getOutputInterface($this->options);
+
+		$this::assertInstanceOf(FPDF::class, $this->outputInterface->dump());
+	}
+
 }

+ 15 - 0
tests/Output/QRImageTest.php

@@ -71,4 +71,19 @@ class QRImageTest extends QROutputTestAbstract{
 		$this::assertTrue(true); // tricking the code coverage
 	}
 
+	/**
+	 * @phan-suppress PhanUndeclaredClassReference
+	 */
+	public function testOutputGetResource():void{
+		$this->options->returnResource = true;
+		$this->outputInterface         = $this->getOutputInterface($this->options);
+
+		$actual = $this->outputInterface->dump();
+
+		/** @noinspection PhpElementIsNotAvailableInCurrentPhpVersionInspection */
+		\PHP_MAJOR_VERSION >= 8
+			? $this::assertInstanceOf(\GdImage::class, $actual)
+			: $this::assertIsResource($actual);
+	}
+
 }

+ 9 - 0
tests/Output/QRImagickTest.php

@@ -12,6 +12,7 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
+use Imagick;
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Output\{QROutputInterface, QRImagick};
 
@@ -69,4 +70,12 @@ class QRImagickTest extends QROutputTestAbstract{
 		$this::assertTrue(true); // tricking the code coverage
 	}
 
+	public function testOutputGetResource():void{
+		$this->options->returnResource = true;
+		$this->outputInterface         = $this->getOutputInterface($this->options);
+
+		$this::assertInstanceOf(Imagick::class, $this->outputInterface->dump());
+	}
+
+
 }