1. Go to this page and download the library: Download radziuk/php-tt 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/ */
radziuk / php-tt example snippets
vendor/radziuk/php-tt/bin/run.php
vendor/radziuk/php-tt/bin/lararun.php
vendor/radziuk/php-tt/bin/run.php src/lib
/**
* @php-tt-assert "hello" >>> "hello"
*/
public function replaceMarkers(string $string): string
/**
* @php-tt-assert "'hello', 'world'" >>> "#1, #2"
*/
public function replaceMarkers(string $string): string
/**
* @php-tt-assert "'hello', 'world'", 1 >>> "#1, 'world'"
*/
public function replaceMarkers(string $string, int $count): string
/**
* @php-tt-assert "'hello', 'world'", ['hello' => 'world'] >>> "#1, 'world'"
*/
public function replaceMarkers(string $string, array $data): string
new \Aradziuk\PhpTT\Tt();
$tt->run(
__DIR__ . '/app', //dir with your classes
__DIR__ . '/test/php-tt' // dir with your data
);
trait MyTrait {
/**
* @php-tt-use-class My\Namespace\CustomClass
* the above command will tell php-tt to use the object of My\Namespace\CustomClass for testing this method. The class should use the trait
* @php-tt-assert "#1, #2" >>> 'hello, world'
*/
public function replaceMarkers(string $string): string
vendor/radziuk/php-tt/bin/lararun.php
artisan make:command PhpTT
$tt = new \Radziuk\PhpTT\Tt();
$tt->setOutputCallback('info', function (string $string) {
$this->info($string);
})->setOutputCallback('error', function (string $string){
$this->error($string);
})->setOutputCallback('alert', function (string $string){
$this->alert($string);
}); // use artisan generic out put
$tt->run(
app_path(),
base_path('tests/php-tt-data')
);