2019-03-27 05:50:13 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature;
|
|
|
|
|
|
|
|
use App\Jobs\Account\CreateAccount;
|
|
|
|
use App\Models\Account;
|
|
|
|
use App\Models\Client;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Utils\Traits\UserSessionAttributes;
|
|
|
|
use Faker\Factory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\Session;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
2019-04-20 01:02:49 +02:00
|
|
|
/**
|
|
|
|
* @test
|
2019-04-04 11:28:53 +02:00
|
|
|
* @covers App\Http\Controllers\AccountController
|
|
|
|
*/
|
|
|
|
|
2019-03-27 05:50:13 +01:00
|
|
|
class AccountTest extends TestCase
|
|
|
|
{
|
2019-11-25 10:38:55 +01:00
|
|
|
//use DatabaseTransactions;
|
2019-07-08 07:27:06 +02:00
|
|
|
|
2019-04-24 12:01:40 +02:00
|
|
|
public function setUp() :void
|
2019-03-27 05:50:13 +01:00
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
Session::start();
|
|
|
|
|
|
|
|
$this->faker = \Faker\Factory::create();
|
|
|
|
|
|
|
|
Model::reguard();
|
2020-03-29 14:22:14 +02:00
|
|
|
|
|
|
|
if (config('ninja.testvars.travis') !== false) {
|
|
|
|
$this->markTestSkipped('Skip test for CI Testing');
|
|
|
|
}
|
2019-03-27 05:50:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testApiAccountCreation()
|
|
|
|
{
|
2020-03-29 14:22:14 +02:00
|
|
|
|
2019-03-27 05:50:13 +01:00
|
|
|
$data = [
|
|
|
|
'first_name' => $this->faker->firstName,
|
|
|
|
'last_name' => $this->faker->lastName,
|
2019-07-08 23:55:43 +02:00
|
|
|
'name' => $this->faker->company,
|
|
|
|
'email' => $this->faker->unique()->safeEmail,
|
2019-03-27 05:50:13 +01:00
|
|
|
'password' => 'ALongAndBrilliantPassword123',
|
|
|
|
'privacy_policy' => 1,
|
|
|
|
'terms_of_service' => 1
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
$response = $this->withHeaders([
|
|
|
|
'X-API-SECRET' => config('ninja.api_secret'),
|
2019-11-04 01:22:59 +01:00
|
|
|
])->post('/api/v1/signup?include=account', $data);
|
2019-03-27 05:50:13 +01:00
|
|
|
|
2019-04-18 13:57:22 +02:00
|
|
|
$response->assertStatus(200);
|
2019-03-27 05:50:13 +01:00
|
|
|
}
|
2020-03-29 14:22:14 +02:00
|
|
|
|
2019-03-27 05:50:13 +01:00
|
|
|
}
|