<commit_before><?php
require_once __DIR__.'/../vendor/autoload.php';

class FunctionalTests extends PHPUnit_Framework_TestCase
{
	protected $examplesPath;
	/**
	 * @var \ManiaLib\XML\Rendering\Renderer
	 */
	protected $renderer;

	protected function setUp()
	{
		$this->examplesPath = __DIR__.'/../examples/';
		$this->renderer = new \ManiaLib\XML\Rendering\Renderer();
	}

	public function testBasicUsageDOMDocumentDriver()
	{
		$scriptName = 'basic-usage';
		$root = require $this->examplesPath.$scriptName.'.php';
		$this->renderer->setRoot($root);
		$this->assertXmlStringEqualsXmlFile($this->examplesPath.$scriptName.'.xml', $this->renderer->getXML());
	}
}<commit_msg>Created different tests for each driver Tests now scan examples folder<commit_after><?php
require_once __DIR__.'/../vendor/autoload.php';

use Symfony\Component\Finder\Finder;

class FunctionalTests extends PHPUnit_Framework_TestCase
{

	protected $examplesPath;

	/**
	 * @var \ManiaLib\XML\Rendering\Renderer
	 */
	protected $renderer;

	protected function setUp()
	{
		$this->renderer = new \ManiaLib\XML\Rendering\Renderer();
	}

	public function nodeAndResultsProvider()
	{
		$finder = new Finder();
		$finder->in(__DIR__.'/../examples/')->files()->name('*.php');
		$tests = array();
		foreach($finder as $file)
		{
			$node = require $file->getRealPath();
			$expect = $file->getPath().'/'.$file->getBasename($file->getExtension()).'xml';
			$tests[] = array($node, $expect);
		}

		return $tests;
	}

	/**
	 * @dataProvider nodeAndResultsProvider
	 */
	public function testBasicUsageDOMDocumentDriver(ManiaLib\XML\NodeInterface $node, $expectedResult)
	{
		$this->renderer->setRoot($node);
		$this->assertXmlStringEqualsXmlFile($expectedResult, $this->renderer->getXML());
	}

	/**
	 * @dataProvider nodeAndResultsProvider
	 */
	public function testBasicUsageXMLWriterDriver(ManiaLib\XML\NodeInterface $node, $expectedResult)
	{
		$driver = new \ManiaLib\XML\Rendering\Drivers\XMLWriterDriver();
		$driver->setEventDispatcher($this->renderer->getEventDispatcher());
		
		$this->renderer->setRoot($node);
		$this->renderer->setDriver($driver);
		$this->assertXmlStringEqualsXmlFile($expectedResult, $this->renderer->getXML());
	}

}
{'fraction_non_alphanumeric': 0.16681735985533455, 'fraction_numerical': 0.0, 'mean_word_length': 5.063013698630137, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2068983', 'n_tokens_mistral': 744, 'n_tokens_neox': 704, 'n_words': 110}