mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 16:37:31 -04:00 
			
		
		
		
	* Fixes for tests * add additional fields for company settings * fixes for travis * update company settings schema * Disable client portal * Client Portal middleware * Working on client portal * hide portal * Implement notification channgels for User and ClientContact models * Push notifications onto queue * Force authentication if client portal is password protected
		
			
				
	
	
		
			84 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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;
 | |
| 
 | |
| /**
 | |
|  * @test
 | |
|  * @covers App\Http\Controllers\AccountController
 | |
|  */
 | |
| 
 | |
| class AccountTest extends TestCase
 | |
| {
 | |
|     use DatabaseTransactions;
 | |
| 
 | |
|     public function setUp() :void
 | |
|     {
 | |
|         parent::setUp();
 | |
| 
 | |
|         Session::start();
 | |
| 
 | |
|         $this->faker = \Faker\Factory::create();
 | |
| 
 | |
|         Model::reguard();
 | |
|     }
 | |
| 
 | |
|     public function testAccountCreation()
 | |
|     {
 | |
|         $data = [
 | |
|             'first_name' => $this->faker->firstName,
 | |
|             'last_name' => $this->faker->lastName,
 | |
|             'name' => $this->faker->company,
 | |
|             'email' => $this->faker->unique()->safeEmail,
 | |
|             'password' => 'ALongAndBrilliantPassword123',
 | |
|             '_token' => csrf_token(),
 | |
|             'privacy_policy' => 1,
 | |
|             'terms_of_service' => 1
 | |
|         ];
 | |
| 
 | |
|         $response = $this->post('/signup', $data, ['X-API-SECRET' => 'password']);
 | |
| 
 | |
|         $response->assertStatus(200);
 | |
|         
 | |
| 
 | |
|     }
 | |
| 
 | |
|     public function testApiAccountCreation()
 | |
|     {
 | |
| 
 | |
|         $data = [
 | |
|             'first_name' => $this->faker->firstName,
 | |
|             'last_name' => $this->faker->lastName,
 | |
|             'name' => $this->faker->company,
 | |
|             'email' => $this->faker->unique()->safeEmail,
 | |
|             'password' => 'ALongAndBrilliantPassword123',
 | |
|             'privacy_policy' => 1,
 | |
|             'terms_of_service' => 1
 | |
|         ];
 | |
| 
 | |
| 
 | |
|         $response = $this->withHeaders([
 | |
|                 'X-API-SECRET' => config('ninja.api_secret'),
 | |
|             ])->post('/api/v1/signup?include=account', $data);
 | |
| 
 | |
|         $response->assertStatus(200);
 | |
|         
 | |
|     }
 | |
| 
 | |
| 
 | |
| 
 | |
| }
 |