Created
June 24, 2013 12:30
-
-
Save anonymous/5849706 to your computer and use it in GitHub Desktop.
Non-working Laravel test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'default' => 'sqlite', | |
'connections' => array( | |
'sqlite' => array( | |
'driver' => 'sqlite', | |
'database' => ':memory:', | |
'prefix' => '', | |
) | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vendor/bin/phpunit | |
PHPUnit 3.8-dev by Sebastian Bergmann. | |
Configuration read from /Users/learning/PhpstormProjects/laravel_test/phpunit.xml | |
.PHP Fatal error: Call to undefined method User::save() in /Users/learning/PhpstormProjects/laravel_test/app/tests/UserTest.php on line 8 | |
User is Eloquent: YES | |
Fatal error: Call to undefined method User::save() in /Users/learning/PhpstormProjects/laravel_test/app/tests/UserTest.php on line 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TestCase extends Illuminate\Foundation\Testing\TestCase { | |
public function setUp() | |
{ | |
parent::setUp(); | |
$this->prepareForTests(); | |
} | |
/** | |
* Creates the application. | |
* | |
* @return Symfony\Component\HttpKernel\HttpKernelInterface | |
*/ | |
public function createApplication() | |
{ | |
$unitTesting = true; | |
$testEnvironment = 'testing'; | |
return require __DIR__.'/../../bootstrap/start.php'; | |
} | |
private function prepareForTests() | |
{ | |
Artisan::call('migrate'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserTest extends TestCase { | |
public function testUserNameIsAlwaysUppercase() | |
{ | |
$user = new User(); | |
print "User is Eloquent: " . ($user instanceof Eloquent ? "YES" : "NO") . "\n"; | |
$user->save(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment