#3382 - Unit tests for schema.org
| Identifier | #3382 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | Unit tests for schema.org |
| Status | Closed (stale) |
| Tags |
Good for training (custom) |
| Handling member | Chris Graham |
| Addon | General / Uncategorised |
| Description | Run template previews for the following through a schema.org validator...
Home page (WebPage) Author (ProfilePage) Member view (ProfilePage) Feedback page (ContactPage) Calendar block in listing mode (Event) Calendar screen (Event) Catalogue entry view (ItemPage) Catalogue entry view [shopping] (Offer) Download view (ItemPage) Shopping cart (CheckoutPage) Image screen (Image) Video screen (Video) Gallery flow-mode screen for image (Gallery & Image) Gallery flow-mode screen for video (Gallery & Video) Gallery thumb screen (Gallery) News screen (NewsArticle) News screen for blog post (BlogPosting) Comment topic post with review (Review) Rating box (AggregateRating) Search results (SearchResultsPage) New support ticket (ContactPage) IOTD screen (ImageObject) Update the maintenance spreadsheet to reflect standard_schema_org is now unit-tested. |
| Steps to reproduce | |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
<?php /*
Composr
Copyright (c) ocProducts, 2004-2016
See text/EN/licence.txt for full licencing information.
*/
/**
* @license http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
* @copyright ocProducts Ltd
* @package testing_platform
*/
/**
* Composr test case class (unit testing).
*/
class schemadotorg_test_set extends cms_test_case
{
public function setUp()
{
require_code('lorem');
parent::setUp();
}
public function testScreens()
{
$tpl = render_screen_preview('AUTHOR_SCREEN.tpl', 'authors', 'tpl_preview__author_screen');
$this->do_validation($tpl->evaluate());
}
protected function do_validation($data)
{
$url = 'https://search.google.com/structured-data/testing-tool/u/0/validate';
$post_params = array('html' => $data);
$result = http_download_file($url, null, true, false, 'Composr', $post_params);
}
public function tearDown()
{
parent::tearDown();
}
}
... but I can't find a validator we can easily use as an API. Google's returns a load of JavaScript.