-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Lustmored/master
Use Glide 2.0
- Loading branch information
Showing
5 changed files
with
50 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: "Unit Tests" | ||
|
||
on: | ||
pull_request: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: ['7.2', '7.3', '7.4', '8.0'] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
- name: Install dependencies | ||
run: composer install --no-interaction --no-ansi | ||
- name: PHPUnit | ||
run: php vendor/bin/phpunit |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
<?php | ||
|
||
namespace League\Glide\Responses; | ||
namespace Responses; | ||
|
||
use League\Glide\Responses\SymfonyResponseFactory; | ||
use Mockery; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class SymfonyResponseFactoryTest extends \PHPUnit_Framework_TestCase | ||
class SymfonyResponseFactoryTest extends TestCase | ||
{ | ||
public function tearDown() | ||
public function tearDown(): void | ||
{ | ||
Mockery::close(); | ||
} | ||
|
||
public function testCreateInstance() | ||
public function testCreateInstance(): void | ||
{ | ||
$this->assertInstanceOf( | ||
self::assertInstanceOf( | ||
'League\Glide\Responses\SymfonyResponseFactory', | ||
new SymfonyResponseFactory() | ||
); | ||
} | ||
|
||
public function testCreate() | ||
public function testCreate(): void | ||
{ | ||
$this->cache = Mockery::mock('League\Flysystem\FilesystemInterface', function ($mock) { | ||
$mock->shouldReceive('getMimetype')->andReturn('image/jpeg')->once(); | ||
$mock->shouldReceive('getSize')->andReturn(0)->once(); | ||
$cache = Mockery::mock('League\Flysystem\FilesystemOperator', function ($mock) { | ||
$mock->shouldReceive('mimeType')->andReturn('image/jpeg')->once(); | ||
$mock->shouldReceive('fileSize')->andReturn(0)->once(); | ||
$mock->shouldReceive('readStream'); | ||
}); | ||
|
||
$factory = new SymfonyResponseFactory(); | ||
$response = $factory->create($this->cache, ''); | ||
$response = $factory->create($cache, ''); | ||
|
||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); | ||
$this->assertEquals('image/jpeg', $response->headers->get('Content-Type')); | ||
$this->assertEquals('0', $response->headers->get('Content-Length')); | ||
$this->assertContains(gmdate('D, d M Y H:i', strtotime('+1 years')), $response->headers->get('Expires')); | ||
$this->assertEquals('max-age=31536000, public', $response->headers->get('Cache-Control')); | ||
self::assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); | ||
self::assertEquals('image/jpeg', $response->headers->get('Content-Type')); | ||
self::assertEquals('0', $response->headers->get('Content-Length')); | ||
self::assertStringContainsString(gmdate('D, d M Y H:i', strtotime('+1 years')), $response->headers->get('Expires')); | ||
self::assertEquals('max-age=31536000, public', $response->headers->get('Cache-Control')); | ||
} | ||
} |