Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Tests\Feature; use App\Models\Album; use App\Services\MediaMetadataServi..
Decoded Output download
<?php
namespace Tests\Feature;
use App\Models\Album;
use App\Services\MediaMetadataService;
use Mockery;
use Mockery\MockInterface;
class AlbumThumbnailTest extends TestCase
{
private MockInterface $mediaMetadataService;
public function setUp(): void
{
parent::setUp();
$this->mediaMetadataService = self::mock(MediaMetadataService::class);
}
/** @return array<mixed> */
public function provideAlbumThumbnailData(): array
{
return [['http://localhost/img/covers/foo_thumbnail.jpg'], [null]];
}
/** @dataProvider provideAlbumThumbnailData */
public function testGetAlbumThumbnail(?string $thumbnailUrl): void
{
/** @var Album $createdAlbum */
$createdAlbum = Album::factory()->create();
$this->mediaMetadataService
->shouldReceive('getAlbumThumbnailUrl')
->once()
->with(Mockery::on(static function (Album $album) use ($createdAlbum): bool {
return $album->id === $createdAlbum->id;
}))
->andReturn($thumbnailUrl);
$response = $this->getAs("api/album/{$createdAlbum->id}/thumbnail");
$response->assertJson(['thumbnailUrl' => $thumbnailUrl]);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Tests\Feature;
use App\Models\Album;
use App\Services\MediaMetadataService;
use Mockery;
use Mockery\MockInterface;
class AlbumThumbnailTest extends TestCase
{
private MockInterface $mediaMetadataService;
public function setUp(): void
{
parent::setUp();
$this->mediaMetadataService = self::mock(MediaMetadataService::class);
}
/** @return array<mixed> */
public function provideAlbumThumbnailData(): array
{
return [['http://localhost/img/covers/foo_thumbnail.jpg'], [null]];
}
/** @dataProvider provideAlbumThumbnailData */
public function testGetAlbumThumbnail(?string $thumbnailUrl): void
{
/** @var Album $createdAlbum */
$createdAlbum = Album::factory()->create();
$this->mediaMetadataService
->shouldReceive('getAlbumThumbnailUrl')
->once()
->with(Mockery::on(static function (Album $album) use ($createdAlbum): bool {
return $album->id === $createdAlbum->id;
}))
->andReturn($thumbnailUrl);
$response = $this->getAs("api/album/{$createdAlbum->id}/thumbnail");
$response->assertJson(['thumbnailUrl' => $thumbnailUrl]);
}
}
Function Calls
None |
Stats
MD5 | e66c5636a9e9f6af28fb422922d2cce7 |
Eval Count | 0 |
Decode Time | 106 ms |