controllerTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Grav\Plugin;
  3. /**
  4. * Class ControllerTest
  5. */
  6. class ControllerTest extends \Codeception\TestCase\Test
  7. {
  8. protected $controller;
  9. protected function _before()
  10. {
  11. require_once(__DIR__ . '/../../../classes/adminbasecontroller.php');
  12. require_once(__DIR__ . '/../../../classes/admincontroller.php');
  13. $this->controller = new \Grav\Plugin\Admin\AdminController();
  14. }
  15. protected function _after()
  16. {
  17. }
  18. public function testDetermineFilenameIncludingLanguage()
  19. {
  20. $language = 'en-GB';
  21. $this->assertSame('testing.en-GB.md', $this->controller->determineFilenameIncludingLanguage('testing.md', $language));
  22. $this->assertSame('testing.en-GB.md', $this->controller->determineFilenameIncludingLanguage('testing.en.md', $language));
  23. $this->assertSame('testing.en-GB.md', $this->controller->determineFilenameIncludingLanguage('testing.it.md', $language));
  24. $this->assertSame('testing.en-GB.md', $this->controller->determineFilenameIncludingLanguage('testing.en-GB.md', $language));
  25. $language = 'it';
  26. $this->assertSame('testing.it.md', $this->controller->determineFilenameIncludingLanguage('testing.md', $language));
  27. $this->assertSame('testing.it.md', $this->controller->determineFilenameIncludingLanguage('testing.en.md', $language));
  28. $this->assertSame('testing.it.md', $this->controller->determineFilenameIncludingLanguage('testing.it.md', $language));
  29. $this->assertSame('testing.it.md', $this->controller->determineFilenameIncludingLanguage('testing.en-GB.md', $language));
  30. }
  31. }