#3382 - Unit tests for schema.org
0 guests and 0 members have recently viewed this.
The top 3 point earners from 14th Dec 2025 to 21st Dec 2025.
| PDStig |
|
|
|---|---|---|
| Gabri |
|
|
| sholzy |
|
|
There are no events at this time
<?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.