Problem/Motivation

All field formatters supporting RDFa will most likely be making use of the FieldRdfaTestBase class to write tests. Given that we're in unit test, there is no default page output available to aid debugging in the test results.

Proposed resolution

Add our own debugging output for the HTML rendered by the field formatter (which includes the RDFa markup) and the RDF graph as parsed by EasyRdf.

The debug mode will be enabled with the 'debug' property on the FieldRdfaTestBase class. It could default to TRUE.

Remaining tasks

write a patch

User interface changes

none

API changes

new 'debug' property in FieldRdfaTestBase.

Comments

scor’s picture

Title: Add debug mode to FieldRdfaTestBase() » Add debug mode to FieldRdfaTestBase class
ashepherd’s picture

Assigned: Unassigned » ashepherd
ashepherd’s picture

Status: Active » Needs review
StatusFileSize
new1.02 KB
ashepherd’s picture

removed whitespace from 1st patch

ashepherd’s picture

wrapped the debug() calls with check of $debug property

lokapujya’s picture

+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php
@@ -84,6 +91,12 @@ protected function assertFormatterRdfa($formatter, $property, $expected_rdf_valu
+    if( $debug ){

The if statement should follow the drupal coding standards.

ashepherd’s picture

ah, thanks!

The last submitted patch, 5: add-debug-info-field-test-base-2266763-5.patch, failed testing.

lokapujya’s picture

Closer. Typically, we don't have spaces inside the parenthesis.

Status: Needs review » Needs work

The last submitted patch, 7: add-debug-info-field-test-base-2266763-7.patch, failed testing.

ashepherd’s picture

I'm a bonehead...my bad. thanks Jamie

ashepherd’s picture

Status: Needs work » Needs review
scor’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php
    @@ -39,6 +39,13 @@
    +   * Should debugging output be displayed.
    

    Maybe a better description message would be "TRUE if verbose debugging is enabled."

  2. +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php
    @@ -84,6 +91,12 @@ protected function assertFormatterRdfa($formatter, $property, $expected_rdf_valu
    +    if ($this->debug) {
    +      debug($output);
    +      debug($graph->toRdfPhp());
    +    }
    

    Maybe add comment saying that both the HTML and the parsed RDF are displayed in the results.

ashepherd’s picture

Status: Needs work » Needs review
StatusFileSize
new1.12 KB

+1

scor’s picture

Status: Needs review » Needs work
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaTestBase.php
@@ -84,6 +91,13 @@ protected function assertFormatterRdfa($formatter, $property, $expected_rdf_valu
+    // If verbose debugging is turned on, display the HTML and parsed RDF in the results

line should be < 80 characters. Make sure you end the sentence with a period :)

kay_v’s picture

Status: Needs work » Needs review
StatusFileSize
new1.13 KB

made suggested changes.

kay_v’s picture

stripped trailing whitespace at end of comment line :)

scor’s picture

Status: Needs review » Reviewed & tested by the community

Let's do this...

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: add-debug-info-field-test-base-2266763-17.patch, failed testing.

yup, PSR-4.

lauggh’s picture

Assigned: ashepherd » lauggh
Status: Needs work » Needs review
StatusFileSize
new1.09 KB

re-rolled the patch to use /src instead of /lib/Drupal/rdf/

scor’s picture

Status: Needs review » Reviewed & tested by the community

patch looks good now. Thanks Grace for the reroll!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed fb01ce4 and pushed to 8.x. Thanks!

  • alexpott committed fb01ce4 on 8.x
    Issue #2266763 by ashepherd, kay_v, lauggh | scor: Add debug mode to...

Status: Fixed » Closed (fixed)

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