Nezavolá se z toho důvodu, že DIC není vůbec potřeba (tím pádem nefunguje třeba robot loader). Failing test:
<?php
namespace Tests;
use App;
use Nette;
use Tester;
require __DIR__ . '/bootstrap.php';
/**
* @testCase
*/
class ComponentTest extends Tester\TestCase
{
use \Testbench\TComponent;
public function testRender()
{
$control = new App\Components\DrinkingStreamControl();
$this->checkRenderOutput($control, 'drink');
}
}
(new ComponentTest)->run();
Kde DrinkingStreamControl je:
<?php
namespace App\Components;
use Nette;
class DrinkingStreamControl extends Nette\Application\UI\Control
{
public function __construct()
{
parent::__construct(); // vždy je potřeba volat rodičovský konstruktor
}
public function render()
{
$this->template->setFile( __DIR__ . '/DrinkingStream.latte' );
$this->template->render();
}
}
Nezavolá se z toho důvodu, že DIC není vůbec potřeba (tím pádem nefunguje třeba robot loader). Failing test:
Kde
DrinkingStreamControl
je:A
boostrap.php
:Dočasné řešení je trošku potunit bootstrap:
https://forum.nette.org/cs/25627-jak-otestovat-obsah-prvku-control#p177380