mrtnzlml-archive / testbench

:green_apple: Simple integration testing tool for Nette applications
http://zlml.cz/jednoduche-testovani-pro-uplne-kazdeho
41 stars 13 forks source link

TComponent neumí zaregistrovat anonymní komponenty #22

Closed mrtnzlml closed 8 years ago

mrtnzlml commented 8 years ago
Nette\InvalidArgumentException: Component name must be non-empty alphanumeric string, 'class@anonymous /var/www/html/workshop-testbench2/tests/HomepagePresenter.phpt0x7fca3face366' given.
public function testComponentRender()
{
    $control = new class extends \Nette\Application\UI\Control
    {
        public function render()
        {
            echo 'ok';
        }
    };
    //$this->attachToPresenter($control, 'custom-name');   <- custom name needed
    $this->checkRenderOutput($control, 'ok');
}

PHP 7 only!