Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: added some missing Twig extension unit tests
- Loading branch information
Showing
11 changed files
with
217 additions
and
4 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
phpmyfaq/src/phpMyFAQ/Template/CategoryNameTwigExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
phpmyfaq/src/phpMyFAQ/Template/FormatDateTwigExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace phpMyFAQ\Template; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\TwigFilter; | ||
|
||
class CategoryNameTwigExtensionTest extends TestCase | ||
{ | ||
public function testGetFilters(): void | ||
{ | ||
$extension = new CategoryNameTwigExtension(); | ||
|
||
$filters = $extension->getFilters(); | ||
|
||
$this->assertCount(1, $filters); | ||
|
||
$this->assertInstanceOf(TwigFilter::class, $filters[0]); | ||
$this->assertEquals('categoryName', $filters[0]->getName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace phpMyFAQ\Template; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\TwigFilter; | ||
|
||
class FaqTwigExtensionTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
$this->extension = new FaqTwigExtension(); | ||
} | ||
|
||
public function testGetFilters(): void | ||
{ | ||
$filters = $this->extension->getFilters(); | ||
|
||
$this->assertCount(1, $filters); | ||
|
||
$this->assertInstanceOf(TwigFilter::class, $filters[0]); | ||
$this->assertEquals('faqQuestion', $filters[0]->getName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace phpMyFAQ\Template; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\TwigFilter; | ||
|
||
class FormatBytesTwigExtensionTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
$this->extension = new FormatBytesTwigExtension(); | ||
} | ||
|
||
public function testGetFilters() | ||
{ | ||
$filters = $this->extension->getFilters(); | ||
|
||
$this->assertCount(1, $filters); | ||
|
||
$this->assertInstanceOf(TwigFilter::class, $filters[0]); | ||
$this->assertEquals('formatBytes', $filters[0]->getName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace phpMyFAQ\Template; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\TwigFilter; | ||
|
||
class FormatDateTwigExtensionTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
$this->extension = new FormatDateTwigExtension(); | ||
} | ||
|
||
public function testGetFilters(): void | ||
{ | ||
$filters = $this->extension->getFilters(); | ||
|
||
$this->assertCount(1, $filters); | ||
|
||
$this->assertInstanceOf(TwigFilter::class, $filters[0]); | ||
$this->assertEquals('formatDate', $filters[0]->getName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace phpMyFAQ\Template; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\TwigFilter; | ||
|
||
class IsoDateTwigExtensionTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
$this->extension = new IsoDateTwigExtension(); | ||
} | ||
|
||
public function testGetFilters(): void | ||
{ | ||
$filters = $this->extension->getFilters(); | ||
|
||
$this->assertCount(1, $filters); | ||
|
||
$this->assertInstanceOf(TwigFilter::class, $filters[0]); | ||
$this->assertEquals('createIsoDate', $filters[0]->getName()); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/phpMyFAQ/Template/PermissionTranslationTwigExtensionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace phpMyFAQ\Template; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\TwigFilter; | ||
|
||
class PermissionTranslationTwigExtensionTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
$this->extension = new PermissionTranslationTwigExtension(); | ||
} | ||
|
||
public function testGetFilters() | ||
{ | ||
$filters = $this->extension->getFilters(); | ||
|
||
$this->assertCount(1, $filters); | ||
|
||
$this->assertInstanceOf(TwigFilter::class, $filters[0]); | ||
$this->assertEquals('permission', $filters[0]->getName()); | ||
} | ||
} |