Refresh
This commit is contained in:
22
tests/CreatesApplication.php
Executable file
22
tests/CreatesApplication.php
Executable 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
40
tests/Feature/CleanerTest.php
Executable 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
21
tests/Feature/ExampleTest.php
Executable 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
10
tests/TestCase.php
Executable 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
18
tests/Unit/ExampleTest.php
Executable 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user