knpSnappy = $this->getMockBuilder(Pdf::class)->getMock(); } /** * @see PdfEncoder::support() */ public function testSupport(): void { $encoder = $this->getMockBuilder(PdfEncoder::class) ->setConstructorArgs([$this->knpSnappy]) ->setMethodsExcept(['support']) ->getMock(); $this->assertTrue($encoder->support('pdf')); $this->assertFalse($encoder->support('txt')); } /** * @see PdfEncoder::getDefaultOptions() */ public function testGetDefaultOptions(): void { $encoder = $this->getMockBuilder(PdfEncoder::class) ->setConstructorArgs([$this->knpSnappy]) ->setMethodsExcept(['getDefaultOptions']) ->getMock(); $this->assertIsArray($encoder->getDefaultOptions()); } /** * @see PdfEncoder::encode() */ public function testEncode(): void { $encoder = $this->getMockBuilder(PdfEncoder::class) ->setConstructorArgs([$this->knpSnappy]) ->setMethodsExcept(['encode']) ->getMock(); $encoder->method('getDefaultOptions')->willReturn(['defaultOption' => 1]); $this->knpSnappy ->expects(self::once()) ->method('getOutputFromHtml') ->with('