Skip to content

Commit

Permalink
Add functional testing on TwigColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
curry684 committed Mar 25, 2024
1 parent 4e3f175 commit 5a46917
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Doctrine\ORM\QueryBuilder;
use Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter;
use Omines\DataTablesBundle\Column\TextColumn;
use Omines\DataTablesBundle\Column\TwigColumn;
use Omines\DataTablesBundle\DataTable;
use Omines\DataTablesBundle\DataTableTypeInterface;
use Tests\Fixtures\AppBundle\Entity\Employee;
Expand All @@ -33,7 +34,7 @@ public function configure(DataTable $dataTable, array $options): void
{
$dataTable
->add('firstName', TextColumn::class)
->add('lastName', TextColumn::class)
->add('lastName', TwigColumn::class, ['template' => '@App/lastname_cell.html.twig'])
->add('fullName', TextColumn::class)
->add('company', TextColumn::class, ['field' => 'c.name'])
->createAdapter(ORMAdapter::class, [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ value }}
5 changes: 4 additions & 1 deletion tests/Functional/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,16 @@ public function testTranslation(string $locale, string $languageProcessing, stri
$this->client->request('GET', sprintf('/%s/translation', $locale));
$this->assertSuccessful($response = $this->client->getResponse());

$content = $response->getContent();
$content = $response->getContent() ?: 'Empty content';
$this->assertStringContainsString('"name":"noCDN"', $content);
$this->assertStringNotContainsString('"options":{"language":{"url"', $content);
$this->assertStringContainsString(sprintf('"processing":"%s"', $languageProcessing), $content);
$this->assertStringContainsString(sprintf('"infoFiltered":"%s"', $languageInfoFiltered), $content);
}

/**
* @return string[][]
*/
public static function translationProvider(): array
{
return [
Expand Down

0 comments on commit 5a46917

Please sign in to comment.