There was 1 error:

1) Drupal\Tests\Core\Template\AttributeTest::testPrint
strstr(): Empty needle

/usr/share/php/PHPUnit/Util/XML.php:626
/usr/share/php/PHPUnit/Util/XML.php:468
/var/www/d8/core/tests/Drupal/Tests/Core/Template/AttributeTest.php:96
/usr/share/php/PHPUnit/TextUI/Command.php:192
/usr/share/php/PHPUnit/TextUI/Command.php:130
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ParisLiakos’s picture

Issue tags: +PHP 5.5

this is the last test after the json one, for our phpunit test suite to be green under php 5.5

ParisLiakos’s picture

Priority: Major » Normal

nvm..this is a phpunit thing..seems the debian package is quite outdated
this was fixed...2 years ago upstream!

if you run tests using the vendor binary it still works..

i still think we should fix the test to work with the debian binary version, the fix is pretty simple i think

ParisLiakos’s picture

Title: AttributeTest fails under php 5.5 » AttributeTest fails when using debian's phpunit binary
Issue tags: -PHP 5.5
FileSize
1.24 KB

here is whats missing from debian's version of phpunit, that causes this test to fail:
https://github.com/sebastianbergmann/phpunit/commit/f48cb8ba2903b2da3a63...

and here is a patch that adds some contents in the div, rather than being empty

ParisLiakos’s picture

Status: Active » Needs review
dawehner’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +PHPUnit

Even if it is not stricly needed I consider this as improvement!

Mile23’s picture

+++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
@@ -92,12 +92,13 @@ public function testIterate() {
   public function testPrint() {
     $attribute = new Attribute(array('class' => array('example-class'), 'id' => 'example-id', 'enabled' => TRUE));
 
-    $html = '<div' . (string) $attribute . '></div>';
-    $this->assertSelectEquals('div.example-class', '', 1, $html);
-    $this->assertSelectEquals('div.example-class2', '', 0, $html);
+    $content = $this->randomName();
+    $html = '<div' . (string) $attribute . '>' . $content . '</div>';
+    $this->assertSelectEquals('div.example-class', $content, 1, $html);
+    $this->assertSelectEquals('div.example-class2', $content, 0, $html);

I hate to tell someone to change a test fundamentally, but that's really screaming out for a @dataprovider.

webchick’s picture

Status: Reviewed & tested by the community » Needs review

Sorry, but I do not parse that comment. :) Is this ok as an interim fix, or does #6 need to be addressed?

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

#6 is out of scope

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed ae84e25 and pushed to 8.x. Thanks!

alexpott’s picture

Should have said - yep I agree that #6 is out of scope

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.