1. Go to this page and download the library: Download contao/test-case 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/ */
contao / test-case example snippets
use Contao\TestCase\ContaoTestCase;
class MyTest extends ContaoTestCase
{
}
$container = $this->getContainerWithContaoConfiguration();
echo $container->getParameter('contao.upload_path'); // will output "files"
$container = $this->getContainerWithContaoConfiguration('/tmp');
echo $container->getParameter('kernel.project_dir'); // will output "/tmp"
echo $container->getParameter('kernel.root_dir'); // will output "/tmp/app"
echo $container->getParameter('kernel.cache_dir'); // will output "/tmp/var/cache"
$fs = new Filesystem();
$fs->mkdir($this->getTempDir().'/var/cache');
use Contao\TestCase\ContaoTestCase;
class MyTest extends ContaoTestCase
{
public static function tearDownAfterClass()
{
// The temporary directory would not be removed without this call!
parent::tearDownAfterClass();
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.