Pull merge.
[yaffs-website] / web / core / tests / Drupal / Tests / AssertHelperTraitTest.php
1 <?php
2
3 namespace Drupal\Tests;
4
5 use Drupal\Core\Render\Markup;
6
7 /**
8  * @coversDefaultClass \Drupal\Tests\AssertHelperTrait
9  * @group simpletest
10  * @group Tests
11  */
12 class AssertHelperTraitTest extends UnitTestCase {
13
14   /**
15    * @covers ::castSafeStrings
16    * @dataProvider providerCastSafeStrings
17    */
18   public function testCastSafeStrings($expected, $value) {
19     $class = new AssertHelperTestClass();
20     $this->assertSame($expected, $class->testMethod($value));
21   }
22
23   public function providerCastSafeStrings() {
24     $safe_string = Markup::create('test safe string');
25     return [
26       ['test simple string', 'test simple string'],
27       [['test simple array', 'test simple array'], ['test simple array', 'test simple array']],
28       ['test safe string', $safe_string],
29       [['test safe string', 'test safe string'], [$safe_string, $safe_string]],
30       [['test safe string', 'mixed array', 'test safe string'], [$safe_string, 'mixed array', $safe_string]],
31     ];
32   }
33
34 }
35
36 class AssertHelperTestClass {
37   use AssertHelperTrait;
38
39   public function testMethod($value) {
40     return $this->castSafeStrings($value);
41   }
42
43 }