assertTrue($sut->supports($this->getInvoiceDocument('default.html.twig'))); $this->assertTrue($sut->supports($this->getInvoiceDocument('freelancer.html.twig'))); $this->assertTrue($sut->supports($this->getInvoiceDocument('timesheet.html.twig'))); $this->assertFalse($sut->supports($this->getInvoiceDocument('foo.html.twig'))); $this->assertFalse($sut->supports($this->getInvoiceDocument('company.docx'))); $this->assertFalse($sut->supports($this->getInvoiceDocument('export.csv'))); $this->assertFalse($sut->supports($this->getInvoiceDocument('spreadsheet.xlsx'))); $this->assertFalse($sut->supports($this->getInvoiceDocument('open-spreadsheet.ods'))); } public function testRender() { $kernel = self::bootKernel(); /** @var \Twig_Environment $twig */ $twig = $kernel->getContainer()->get('twig'); $stack = $kernel->getContainer()->get('request_stack'); $request = new Request(); $request->setLocale('en'); $stack->push($request); /** @var FilesystemLoader $loader */ $loader = $twig->getLoader(); $loader->addPath($this->getInvoiceTemplatePath(), 'invoice'); $sut = new TwigRenderer($twig); $model = $this->getInvoiceModel(); $document = $this->getInvoiceDocument('timesheet.html.twig'); $response = $sut->render($document, $model); $content = $response->getContent(); $this->assertContains('', $content); $this->assertEquals(5, substr_count($content, 'activity description / project name')); } }