Skip to content
Snippets Groups Projects

Issue #3130107: Extend unit test coverage for LanguageNegotiationContentEntity

Open Stefanos Petrakis requested to merge issue/drupal-3130107:3130107-add-unit-test into 10.1.x
3 files
+ 13
11
Compare changes
  • Side-by-side
  • Inline
Files
3
  • 377b4066
    Issue #2503063 by alexpott, Lendude: Removing XssTest causes test failures due... · 377b4066
    catch authored
    Issue #2503063 by alexpott, Lendude: Removing XssTest causes test failures due to UrlHelper's static $allowedProtocols
@@ -18,8 +18,13 @@ class LinkExternalProtocolsConstraintValidatorTest extends UnitTestCase {
/**
* @covers ::validate
* @dataProvider providerValidate
* @runInSeparateProcess
*/
public function testValidate($value, $valid) {
public function testValidate($url, $valid) {
$link = $this->createMock('Drupal\link\LinkItemInterface');
$link->expects($this->any())
->method('getUrl')
->willReturn(Url::fromUri($url));
$context = $this->createMock(ExecutionContextInterface::class);
if ($valid) {
@@ -38,7 +43,7 @@ public function testValidate($value, $valid) {
$validator = new LinkExternalProtocolsConstraintValidator();
$validator->initialize($context);
$validator->validate($value, $constraint);
$validator->validate($link, $constraint);
}
/**
@@ -56,15 +61,6 @@ public function providerValidate() {
// Invalid protocols.
$data[] = ['ftp://ftp.funet.fi/pub/standards/RFC/rfc959.txt', FALSE];
foreach ($data as &$single_data) {
$url = Url::fromUri($single_data[0]);
$link = $this->createMock('Drupal\link\LinkItemInterface');
$link->expects($this->any())
->method('getUrl')
->willReturn($url);
$single_data[0] = $link;
}
return $data;
}
Loading