#3382 - Unit tests for schema.org This is a spacer post for a website comment topic. The content this topic relates to: #3382 - Unit tests for schema.org By Guest posted 20th Jan 2018, 5:13 PM Do not fill this field in. I wrote this test code... <?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. 0 guests and 0 members have recently viewed this. Sort: Relevance Newest first Oldest first Rating Popularity
<?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.