Added laravel framework. Bootstrap absolute minimum. Add testing framework that follows Laravel practices. Write simple feature test to test caching.
This commit is contained in:
committed by
davidcallizaya
parent
5874fce1b5
commit
6458dc64a1
17
tests/CreatesApplication.php
Normal file
17
tests/CreatesApplication.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
19
tests/Feature/CacheTest.php
Normal file
19
tests/Feature/CacheTest.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CacheTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic cache example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCache()
|
||||
{
|
||||
Cache::put('foo', 'bar', 5);
|
||||
$this->assertEquals('bar', (Cache::get('foo')));
|
||||
}
|
||||
}
|
||||
8
tests/TestCase.php
Normal file
8
tests/TestCase.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace Tests;
|
||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
use CreatesApplication;
|
||||
}
|
||||
Reference in New Issue
Block a user