-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UHF-8909: Added Kernel test for default language variables.
- Loading branch information
Showing
4 changed files
with
41 additions
and
214 deletions.
There are no files selected for viewing
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 was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
tests/src/Kernel/Language/DefaultLanguageVariablesTest.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,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\Tests\helfi_api_base\Kernel\Language; | ||
|
||
use Drupal\KernelTests\KernelTestBase; | ||
|
||
/** | ||
* Tests helfi_api_base_template_preprocess_default_variables_alter(). | ||
* | ||
* @group helfi_api_base | ||
*/ | ||
class DefaultLanguageVariablesTest extends KernelTestBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected static $modules = [ | ||
'helfi_api_base', | ||
]; | ||
|
||
/** | ||
* Test helfi_api_base_template_preprocess_default_variables_alter(). | ||
*/ | ||
public function testDefaultLanguageVariables(): void { | ||
// Prepare variables for the page template. | ||
$render_array = [ | ||
'#theme' => 'page', | ||
'#content' => ['#markup' => 'Test content'], | ||
]; | ||
\Drupal::moduleHandler()->alter('template_preprocess_default_variables', $render_array); | ||
\Drupal::moduleHandler()->invokeAll('preprocess_page', [&$render_array]); | ||
|
||
// Check if variables are set correctly. | ||
$this->assertInstanceOf('Drupal\Core\Language\Language', $render_array['language']); | ||
$this->assertNotNull($render_array['alternative_language']); | ||
} | ||
|
||
} |
144 changes: 0 additions & 144 deletions
144
tests/src/Unit/Language/DefaultLanguageVariablesTest.php
This file was deleted.
Oops, something went wrong.