mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 10:13:39 -05:00 
			
		
		
		
	* Dispatch | PdfCreatorTest | Removed deprecated method * Dispatch | Remove deprecated dispatchNow() method and use dispatchSync or call handle() on class where return is mandatory.
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 * Invoice Ninja (https://invoiceninja.com).
 | 
						|
 *
 | 
						|
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
						|
 *
 | 
						|
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @license https://www.elastic.co/licensing/elastic-license
 | 
						|
 */
 | 
						|
 | 
						|
namespace Tests\Integration;
 | 
						|
 | 
						|
use App\Jobs\Util\UploadFile;
 | 
						|
use Illuminate\Foundation\Testing\DatabaseTransactions;
 | 
						|
use Illuminate\Http\UploadedFile;
 | 
						|
use Illuminate\Routing\Middleware\ThrottleRequests;
 | 
						|
use Tests\MockAccountData;
 | 
						|
use Tests\TestCase;
 | 
						|
 | 
						|
/**
 | 
						|
 * @test
 | 
						|
 * @covers  App\Jobs\Util\UploadFile
 | 
						|
 */
 | 
						|
class UploadFileTest extends TestCase
 | 
						|
{
 | 
						|
    use MockAccountData;
 | 
						|
    use DatabaseTransactions;
 | 
						|
 | 
						|
    protected function setUp() :void
 | 
						|
    {
 | 
						|
        parent::setUp();
 | 
						|
 | 
						|
        $this->makeTestData();
 | 
						|
 | 
						|
        $this->withoutMiddleware(
 | 
						|
            ThrottleRequests::class
 | 
						|
        );
 | 
						|
    }
 | 
						|
 | 
						|
    public function testFileUploadWorks()
 | 
						|
    {
 | 
						|
        $image = UploadedFile::fake()->image('avatar.jpg');
 | 
						|
 | 
						|
        $document = (new UploadFile(
 | 
						|
            $image,
 | 
						|
            UploadFile::IMAGE,
 | 
						|
            $this->invoice->user,
 | 
						|
            $this->invoice->company,
 | 
						|
            $this->invoice
 | 
						|
        ))->handle();
 | 
						|
 | 
						|
        $this->assertNotNull($document);
 | 
						|
    }
 | 
						|
}
 |