<?php
/**
 * This file contains unit tests for {@link TranscodingActionLinearTables} class
 * of the TransPythia library.
 * 
 * @author Francois Daoust <fd@w3.org>
 * @package Tests
 * @subpackage TransPythia
 * @version $Revision: 1.1 $
 * @license http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html W3C Software Notice and License
 * @copyright Copyright (c) 2009, W3C (MIT, ERCIM, Keio)
 */

require_once("../common/ddrsimpleapi/interface/serviceFactory.php");
require_once("../common/transcoding/transcodingactionlineartables.php");

class TestOfTranscodingActionLinearTable extends UnitTestCase {
    function test_test() {
    	// Load material for testing
		$contents = '<table>
			<tr>
			<td>Truc</td>
			<td>de</td>
			<td>ouf!</td>
			</tr>
			<tr>
			<td>2</td>
			<td>et tu</td>
			<td>sors</td>
			</tr>
			</table>';
    	
		// Construct service to interact with WURFL database.
    	$service = ServiceFactory::newService(
    		'WURFL',
    		'http://www.w3.org/2008/01/ddr-core-vocabulary',
    		array('wurfl_path'=>'../data/wurfl/'));
    	
    	// Prepare transcoding action
    	$action = new TranscodingActionLinearTables($service);
    	
    	// Emulate a Desktop browser and run the linearization
		$evidence = $service->newHTTPEvidenceM(
			array( 'User-Agent' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009090216 Ubuntu/9.04 (jaunty) Firefox/3.0.14' ));
    	$res = $action->apply($contents, $evidence);
    	$this->assertEqual($contents, $res);
    	
    	// Emulate a Nokia8810 and run the linearization
		$evidence = $service->newHTTPEvidenceM(
			array( 'User-Agent' => 'Nokia8810/1.0' ));
    	$res = $action->apply($contents, $evidence);
    
		
    }
}

?>