Skip to content

Commit 6a96706

Browse files
author
Renato Marinho
authored
Merge pull request #256 from GitScrum-Community/develop
Develop
2 parents ed92112 + ec03004 commit 6a96706

File tree

10 files changed

+184
-256
lines changed

10 files changed

+184
-256
lines changed

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@
5252
}
5353
},
5454
"autoload-dev": {
55-
"classmap": [
56-
"tests/TestCase.php",
57-
"tests/support/DatabaseMigrations.php"
58-
]
55+
"psr-4": {
56+
"Tests\\": "tests/"
57+
}
5958
},
6059
"scripts": {
6160
"post-root-package-install": [

database/factories/ModelFactory.php

Lines changed: 107 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,116 @@
1111
|
1212
*/
1313

14-
$factory->define(GitScrum\User::class, function (Faker\Generator $faker) {
15-
static $password;
16-
14+
$factory->define(\GitScrum\Models\User::class, function (Faker\Generator $faker) {
1715
return [
1816
'name' => $faker->name,
1917
'email' => $faker->unique()->safeEmail,
20-
'password' => $password ?: $password = bcrypt('secret'),
18+
'password' => bcrypt('123456'),
2119
'remember_token' => str_random(10),
2220
];
2321
});
22+
23+
$factory->define(\GitScrum\Models\Attachment::class, function (Faker\Generator $faker) {
24+
return [
25+
];
26+
});
27+
28+
$factory->define(\GitScrum\Models\Branch::class, function (Faker\Generator $faker) {
29+
return [
30+
];
31+
});
32+
33+
$factory->define(\GitScrum\Models\Comment::class, function (Faker\Generator $faker) {
34+
return [
35+
];
36+
});
37+
38+
$factory->define(\GitScrum\Models\Commit::class, function (Faker\Generator $faker) {
39+
return [
40+
];
41+
});
42+
43+
$factory->define(\GitScrum\Models\CommitFile::class, function (Faker\Generator $faker) {
44+
return [
45+
];
46+
});
47+
48+
$factory->define(\GitScrum\Models\CommitFilePhpc::class, function (Faker\Generator $faker) {
49+
return [
50+
];
51+
});
52+
53+
$factory->define(\GitScrum\Models\ConfigIssueEffort::class, function (Faker\Generator $faker) {
54+
return [
55+
];
56+
});
57+
58+
$factory->define(\GitScrum\Models\ConfigPriority::class, function (Faker\Generator $faker) {
59+
return [
60+
];
61+
});
62+
63+
$factory->define(\GitScrum\Models\ConfigStatus::class, function (Faker\Generator $faker) {
64+
return [
65+
];
66+
});
67+
68+
$factory->define(\GitScrum\Models\Favorite::class, function (Faker\Generator $faker) {
69+
return [
70+
];
71+
});
72+
73+
$factory->define(\GitScrum\Models\Issue::class, function (Faker\Generator $faker) {
74+
return [
75+
];
76+
});
77+
78+
$factory->define(\GitScrum\Models\IssueType::class, function (Faker\Generator $faker) {
79+
return [
80+
];
81+
});
82+
83+
$factory->define(\GitScrum\Models\Label::class, function (Faker\Generator $faker) {
84+
return [
85+
];
86+
});
87+
88+
$factory->define(\GitScrum\Models\Note::class, function (Faker\Generator $faker) {
89+
return [
90+
];
91+
});
92+
93+
$factory->define(\GitScrum\Models\Organization::class, function (Faker\Generator $faker) {
94+
return [
95+
];
96+
});
97+
98+
$factory->define(\GitScrum\Models\ProductBacklog::class, function (Faker\Generator $faker) {
99+
return [
100+
];
101+
});
102+
103+
$factory->define(\GitScrum\Models\PullRequest::class, function (Faker\Generator $faker) {
104+
return [
105+
];
106+
});
107+
108+
$factory->define(\GitScrum\Models\Sprint::class, function (Faker\Generator $faker) {
109+
return [
110+
];
111+
});
112+
113+
$factory->define(\GitScrum\Models\Status::class, function (Faker\Generator $faker) {
114+
return [
115+
];
116+
});
117+
118+
$factory->define(\GitScrum\Models\UserStat::class, function (Faker\Generator $faker) {
119+
return [
120+
];
121+
});
122+
123+
$factory->define(\GitScrum\Models\UserStory::class, function (Faker\Generator $faker) {
124+
return [
125+
];
126+
});

phpunit.xml

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,22 @@
77
convertNoticesToExceptions="true"
88
convertWarningsToExceptions="true"
99
processIsolation="false"
10-
stopOnFailure="false">
11-
<testsuites>
12-
<testsuite name="Application Test Suite">
13-
<directory suffix="Test.php">./tests</directory>
14-
</testsuite>
15-
<testsuite name="default">
16-
<file>./tests/integration/DashboardTest.php</file>
17-
<file>./tests/unit/UserTest.php</file>
18-
<file>./tests/unit/SprintTest.php</file>
19-
<file>./tests/unit/ProductBacklogTest.php</file>
20-
</testsuite>
21-
</testsuites>
22-
<filter>
23-
<whitelist processUncoveredFilesFromWhitelist="true">
24-
<directory suffix=".php">./app</directory>
25-
</whitelist>
26-
</filter>
27-
<php>
28-
<env name="APP_ENV" value="testing"/>
29-
<env name="CACHE_DRIVER" value="array"/>
30-
<env name="SESSION_DRIVER" value="array"/>
31-
<env name="QUEUE_DRIVER" value="sync"/>
32-
<env name="DB_CONNECTION" value="testing"/>
33-
<env name="DB_DATABASE" value="testing"/>
34-
<env name="APP_PAGINATE" value="10"/>
35-
</php>
36-
</phpunit>
10+
stopOnFailure="false"
11+
syntaxCheck="false">
12+
<testsuites>
13+
<testsuite name="Feature Tests">
14+
<directory suffix="Test.php">./tests/Feature</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist processUncoveredFilesFromWhitelist="true">
19+
<directory suffix=".php">./app</directory>
20+
</whitelist>
21+
</filter>
22+
<php>
23+
<env name="APP_ENV" value="testing"/>
24+
<env name="CACHE_DRIVER" value="array"/>
25+
<env name="SESSION_DRIVER" value="array"/>
26+
<env name="QUEUE_DRIVER" value="sync"/>
27+
</php>
28+
</phpunit>

tests/CreatesApplication.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
use Illuminate\Contracts\Console\Kernel;
6+
7+
trait CreatesApplication
8+
{
9+
/**
10+
* Creates the application.
11+
*
12+
* @return \Illuminate\Foundation\Application
13+
*/
14+
public function createApplication()
15+
{
16+
$app = require __DIR__.'/../bootstrap/app.php';
17+
18+
$app->loadEnvironmentFrom('.env.testing');
19+
20+
$app->make(Kernel::class)->bootstrap();
21+
22+
return $app;
23+
}
24+
25+
public function setUp()
26+
{
27+
parent::setUp();
28+
$this->artisan('migrate');
29+
$this->seed('DummySeeder');
30+
}
31+
32+
public function tearDown()
33+
{
34+
$this->artisan('migrate:reset');
35+
parent::tearDown();
36+
}
37+
}

tests/Features/JWTTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Tests\Feature;
4+
5+
use Config;
6+
use Tests\TestCase;
7+
8+
class JwtAuthenticateTest extends TestCase
9+
{
10+
public function testJwtAuthTest_Login()
11+
{
12+
}
13+
}

tests/TestCase.php

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,10 @@
11
<?php
22

3-
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
4-
{
5-
use DatabaseMigrations;
6-
7-
/**
8-
* The base URL to use while testing the application.
9-
*
10-
* @var string
11-
*/
12-
protected $baseUrl = null;
13-
14-
protected $visitUrl = '/';
15-
16-
/**
17-
* Creates the application.
18-
*
19-
* @return \Illuminate\Foundation\Application
20-
*/
21-
public function createApplication()
22-
{
23-
if (defined('HHVM_VERSION')) {
24-
$this->markTestSkipped('must be revisited.');
25-
}
26-
27-
$app = require __DIR__.'/../bootstrap/app.php';
3+
namespace Tests;
284

29-
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
5+
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
306

31-
$this->baseUrl = env('APP_URL');
32-
33-
return $app;
34-
}
35-
36-
public function setUp()
37-
{
38-
parent::setUp();
39-
$this->initDatabase();
40-
41-
$user = \GitScrum\Models\User::find(1);
42-
$this->be($user);
43-
}
44-
45-
protected function tearDown()
46-
{
47-
//fwrite(STDOUT, __METHOD__ . "\n");
48-
}
7+
abstract class TestCase extends BaseTestCase
8+
{
9+
use CreatesApplication;
4910
}

tests/support/DatabaseMigrations.php

Lines changed: 0 additions & 82 deletions
This file was deleted.

tests/unit/ProductBacklogTest.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)