PHP code example of heimrichhannot / contao-test-utilities-bundle

1. Go to this page and download the library: Download heimrichhannot/contao-test-utilities-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

heimrichhannot / contao-test-utilities-bundle example snippets


class Test {
    use \HeimrichHannot\TestUtilitiesBundle\Mock\ModelMockTrait;
    use \HeimrichHannot\TestUtilitiesBundle\Mock\TemplateMockTrait;
    
    public function testMockTemplate() {
        $templateMock = $this->mockTemplateObject(\Contao\FrontendTemplate::class, 'ce_test');
        $templateMock->setName('ce_skip');
        $templateMock->getName();
        $templateMock->setData(['foo' => 'bar']);
        $templateMock->getData();
        // and __get, __set, __isset
    }
    
    public function testModelMock() {
        $model = $this->mockModelObject(\Contao\PageModel::class, []);
        $model->row();
        // and __get, __set, __isset
    }
}

\HeimrichHannot\TestUtilitiesBundle\Singleton\ResetFilesSingletonTrait::resetFileSingletonInstance()