<?php
/**
 *
 * @copyright Copyright (c) Miroslav Marek <mirek.marek@web-jet.cz>
 * @license http://www.php-jet.net/license/license.txt
 * @author Miroslav Marek <mirek.marek@web-jet.cz>
 */

namespace JetApplicationModule\Test\ORM;

use Jet\DataModel_Backend;
use Jet\MVC_View;
use Jet\Tr;

/**
 * @var MVC_View $this
 * @var Test_Abstract[] $tests
 * @var DataModel_Backend[] $backends
 */

$backends = $this->getRaw( 'backends' );
$tests = $this->getRaw( 'tests' );

?>
	<h1><?= Tr::_( 'ORM tests' ) ?></h1>
	<?php

foreach( $backends as $backend ) {
	DataModel_Backend::setCustomBackend( Model_A1::class, $backend );
	DataModel_Backend::setCustomBackend( Model_A1_1toN::class, $backend );
	DataModel_Backend::setCustomBackend( Model_A1_1toN_sub1toN::class, $backend );
	DataModel_Backend::setCustomBackend( Model_B1::class, $backend );
	DataModel_Backend::setCustomBackend( Model_C1::class, $backend );
	
	?>
	<hr>
	<h2><?= $backend->getTitle() ?></h2>
	<hr>
	<?php foreach( $tests as $t ): ?>
		<h3><?= $t->getTitle() ?></h3>

		<pre><?php $t->test(); ?></pre>
	<?php endforeach; ?>
	<br><br>
	<?php
}
