$tips =
$this->
getTourTips();
$href = Url::
fromRoute('<front>',
[],
['absolute' => TRUE
])->
toString();
$elements =
[];
foreach ($tips as $tip) { if ($tip['id'
] == 'tour-test-1' &&
$tip['module'
] == 'tour_test' &&
$tip['type'
] == 'text' &&
str_contains($tip['body'
],
$href) &&
str_contains($tip['body'
], 'Drupal'
)) { $elements[] =
$tip;
} } $this->
assertCount(1,
$elements, 'Found Token replacement.'
);
$elements =
$this->
findTip([ 'id' => 'tour-test-1',
'title' => 'The first tip',
]);
$this->
assertCount(1,
$elements, 'Found English variant of tip 1.'
);
$elements =
$this->
findTip([ 'id' => 'tour-test-2',
'title' => 'The quick brown fox',
]);
$this->
assertNotCount(1,
$elements, 'Did not find English variant of tip 2.'
);