From 58c9e6f805a67d01ab8aa90b0ea0d64bdab8f04c Mon Sep 17 00:00:00 2001 From: Cyrille Giquello Date: Fri, 15 May 2015 02:10:50 +0200 Subject: [PATCH] some tries #13 --- phpunit.xml | 14 +++++++----- tests/Controllers/RentControllerTest.php | 15 ++++++++----- tests/ExampleTest.php | 2 +- tests/TestCase.php | 28 +++++++++++++++++++++++- 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 48cae2c..7f4d29b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -15,11 +15,13 @@ - - - - - - + + + + + + + + diff --git a/tests/Controllers/RentControllerTest.php b/tests/Controllers/RentControllerTest.php index 13f25dc..c38628e 100644 --- a/tests/Controllers/RentControllerTest.php +++ b/tests/Controllers/RentControllerTest.php @@ -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', @@ -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']); } + } diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php index 7c9e238..fc238a6 100644 --- a/tests/ExampleTest.php +++ b/tests/ExampleTest.php @@ -11,7 +11,7 @@ class ExampleTest extends TestCase public function testBasicExample() { echo __METHOD__, "\n"; - + $response = $this->call( 'GET', '/' ); $this->assertResponseOk(); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 427f680..e3de8c0 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,8 +1,33 @@ 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. * @@ -14,4 +39,5 @@ public function createApplication() return require __DIR__ . '/../bootstrap/app.php'; } + }