create first tests
This commit is contained in:
parent
8071ee5a0a
commit
2387082e88
5 changed files with 52 additions and 22 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -11,3 +11,5 @@ Homestead.yaml
|
||||||
|
|
||||||
composer.lock
|
composer.lock
|
||||||
composer.phar
|
composer.phar
|
||||||
|
|
||||||
|
.phpunit.result.cache
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function log_error(string $message){
|
function log_error(string $message){
|
||||||
file_put_contents('../php_errors.log', $message.PHP_EOL , FILE_APPEND | LOCK_EX);
|
if(!file_exists("../logs"))
|
||||||
|
mkdir("../logs");
|
||||||
|
file_put_contents('../logs/php_errors.log', $message.PHP_EOL , FILE_APPEND | LOCK_EX);
|
||||||
}
|
}
|
||||||
|
|
||||||
$width = 200;
|
$width = 200;
|
||||||
|
|
43
tests/ApiTest.php
Normal file
43
tests/ApiTest.php
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Event;
|
||||||
|
|
||||||
|
class ApiTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testRoot(){
|
||||||
|
$this->get('/');
|
||||||
|
$this->assertEquals(
|
||||||
|
$this->app->version(), $this->response->getOriginalContent()['framework_version']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEvents()
|
||||||
|
{
|
||||||
|
$this->get('/1/events');
|
||||||
|
$this->assertResponseOk();
|
||||||
|
$this->assertEquals('[]',$this->response->getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testContainers()
|
||||||
|
{
|
||||||
|
$this->get('/1/boxes');
|
||||||
|
$this->assertResponseOk();
|
||||||
|
$this->assertEquals('[]',$this->response->getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFiles()
|
||||||
|
{
|
||||||
|
$this->get( '/1/files');
|
||||||
|
$this->assertResponseOk();
|
||||||
|
$this->assertEquals('[]',$this->response->getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItems()
|
||||||
|
{
|
||||||
|
Event::create(['slug'=>'TEST1','name'=>'Test Event 1']);
|
||||||
|
$this->get('/1/TEST1/items');
|
||||||
|
$this->assertResponseOk();
|
||||||
|
$this->assertEquals('[]',$this->response->getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,21 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Laravel\Lumen\Testing\DatabaseMigrations;
|
|
||||||
use Laravel\Lumen\Testing\DatabaseTransactions;
|
|
||||||
|
|
||||||
class ExampleTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic test example.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testExample()
|
|
||||||
{
|
|
||||||
$this->get('/');
|
|
||||||
|
|
||||||
$this->assertEquals(
|
|
||||||
$this->app->version(), $this->response->getContent()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Laravel\Lumen\Testing\DatabaseMigrations;
|
||||||
|
use Laravel\Lumen\Testing\DatabaseTransactions;
|
||||||
|
|
||||||
abstract class TestCase extends Laravel\Lumen\Testing\TestCase
|
abstract class TestCase extends Laravel\Lumen\Testing\TestCase
|
||||||
{
|
{
|
||||||
|
use DatabaseMigrations;
|
||||||
/**
|
/**
|
||||||
* Creates the application.
|
* Creates the application.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue