Permalink
Browse files

phpunit tests

  • Loading branch information...
renatomarinho committed Jul 30, 2017
1 parent e253087 commit ec030046b20323b567535ca0eff552db4b5a4871
Showing with 28 additions and 92 deletions.
  1. +3 −4 composer.json
  2. +19 −27 phpunit.xml
  3. +1 −17 tests/Features/JWTTest.php
  4. +5 −44 tests/TestCase.php
@@ -52,10 +52,9 @@
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/support/DatabaseMigrations.php"
]
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
@@ -7,30 +7,22 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
<testsuite name="default">
<file>./tests/integration/DashboardTest.php</file>
<file>./tests/unit/UserTest.php</file>
<file>./tests/unit/SprintTest.php</file>
<file>./tests/unit/ProductBacklogTest.php</file>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<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_CONNECTION" value="testing"/>
<env name="DB_DATABASE" value="testing"/>
<env name="APP_PAGINATE" value="10"/>
</php>
</phpunit>
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Feature Tests">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<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"/>
</php>
</phpunit>
@@ -7,23 +7,7 @@
class JwtAuthenticateTest extends TestCase
{
public function testJwtAuthenticateTest_Login()
public function testJwtAuthTest_Login()
{
$employee = ClientEmployee::find(1);
$params = [
'nif' => $employee->employee->nif,
'password' => '123456'
];
$employee->update(['rule' => 'owner', 'sent_email' => 1, 'activated' => 1]);
$employee = Employee::find(1);
$employee->update(['password' => '123456']);
$response = $this->post(route('employee.auth'), $params);
$response->assertStatus(200);
$this->assertNotNull($response->original['access_token']);
}
}
@@ -1,49 +1,10 @@
<?php
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
{
use DatabaseMigrations;
/**
* The base URL to use while testing the application.
*
* @var string
*/
protected $baseUrl = null;
protected $visitUrl = '/';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('must be revisited.');
}
$app = require __DIR__.'/../bootstrap/app.php';
namespace Tests;
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
$this->baseUrl = env('APP_URL');
return $app;
}
public function setUp()
{
parent::setUp();
$this->initDatabase();
$user = \GitScrum\Models\User::find(1);
$this->be($user);
}
protected function tearDown()
{
//fwrite(STDOUT, __METHOD__ . "\n");
}
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}

0 comments on commit ec03004

Please sign in to comment.