This commit is contained in:
Richard Dern
2022-01-12 00:35:37 +01:00
commit 400e3d01f1
1363 changed files with 57778 additions and 0 deletions

22
tests/CreatesApplication.php Executable file
View File

@@ -0,0 +1,22 @@
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}

40
tests/Feature/CleanerTest.php Executable file
View File

@@ -0,0 +1,40 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
/**
* @internal
* @coversNothing
*/
class CleanerTest extends TestCase
{
public function testPlainTextStringDefaultParams()
{
$sourceString = 'hello world';
$expectedString = 'hello world';
$this->assertSame($expectedString, \App\Helpers\Cleaner::cleanupString($sourceString));
}
public function testPlainTextStringRemoveExtraSpaces()
{
$sourceString = ' hello world ';
$expectedString = 'hello world';
$this->assertSame($expectedString, \App\Helpers\Cleaner::cleanupString($sourceString, true, true));
}
public function testStripTags()
{
$sourceString = '<script type="text/javascript">hello <span>world</span></script>';
$expectedString = 'hello world';
$this->assertSame($expectedString, \App\Helpers\Cleaner::cleanupString($sourceString, true, true));
}
public function testHtmlStringDefaultParams()
{
}
}

21
tests/Feature/ExampleTest.php Executable file
View File

@@ -0,0 +1,21 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function test_example()
{
$response = $this->get('/');
$response->assertStatus(200);
}
}

10
tests/TestCase.php Executable file
View File

@@ -0,0 +1,10 @@
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}

18
tests/Unit/ExampleTest.php Executable file
View File

@@ -0,0 +1,18 @@
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function test_example()
{
$this->assertTrue(true);
}
}