Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

Commit

Permalink
some tries #13
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrille37 committed May 15, 2015
1 parent 7cc3494 commit 58c9e6f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
14 changes: 8 additions & 6 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_DATABASE" value="/home/cyrille/Code/www/prixDesLoyers.lumen/storage/app/prixDesLoyers-tests.sqlite3"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="APP_ENV" value="testing" />
<env name="APP_DEBUG" value="true" />
<env name="CACHE_DRIVER" value="array" />
<env name="SESSION_DRIVER" value="array" />
<env name="QUEUE_DRIVER" value="sync" />
<env name="DB_CONNECTION" value="sqlite" />
<!-- env name="DB_DATABASE" value="/home/cyrille/Code/www/prixDesLoyers.lumen/storage/app/prixDesLoyers-tests.sqlite3"/ -->
<env name="DB_DATABASE" value=":memory:" />
</php>
</phpunit>
15 changes: 10 additions & 5 deletions tests/Controllers/RentControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@

class RentControllerTest extends \TestCase
{

public function testSimple()
{
echo __METHOD__, "\n";

$response = $this->call('GET', '/');
//error_log( gettype($response));
//error_log( get_class($response));

}

public function ZZZtestSave()
public function zTestCreate()
{
echo __METHOD__, "\n";

$input = array(
'buildingIndividual'=>1,
'buildingStage'=> '2',
Expand All @@ -35,13 +39,14 @@ public function ZZZtestSave()
*/

$response = $this->call('POST', '/rent', $input );
error_log( var_export($response,true));

error_log( var_export($response,true) );
//$view = $response->getOriginalContent();
$view = $response->original;
//$view = $response->getContent();

$this->assertEquals('Tours', $view['city']);

}

}
2 changes: 1 addition & 1 deletion tests/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ExampleTest extends TestCase
public function testBasicExample()
{
echo __METHOD__, "\n";

$response = $this->call( 'GET', '/' );
$this->assertResponseOk();
}
Expand Down
28 changes: 27 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
<?php

//class_alias('Illuminate\Support\Facades\Artisan', 'Artisan');
use Illuminate\Support\Facades\Artisan ;

class TestCase extends Laravel\Lumen\Testing\TestCase
{

public function setUp()
{
parent::setUp();
echo __METHOD__, "\n";
$this->artisanMigrateRefresh();
}

public function tearDown()
{
$this->artisanMigrateReset();
parent::tearDown(); // Moving that call to the top of the function didn't work either.
}

public function artisanMigrateRefresh()
{
Artisan::call('migrate');
}

public function artisanMigrateReset()
{
Artisan::call('migrate:reset');
}

/**
* Creates the application.
*
Expand All @@ -14,4 +39,5 @@ public function createApplication()

return require __DIR__ . '/../bootstrap/app.php';
}

}

0 comments on commit 58c9e6f

Please sign in to comment.