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\ObjectStorage; use App\Events\LibraryChanged; use App\Mode..

Decoded Output download

<?php

namespace Tests\Feature\ObjectStorage;

use App\Events\LibraryChanged;
use App\Models\Song;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Tests\Feature\TestCase;

class S3Test extends TestCase
{
    use WithoutMiddleware;

    public function setUp(): void
    {
        parent::setUp();

        $this->disableMiddlewareForAllTests();
    }

    public function testStoringASong(): void
    {
        $this->post('api/os/s3/song', [
            'bucket' => 'koel',
            'key' => 'sample.mp3',
            'tags' => [
                'title' => 'A Koel Song',
                'album' => 'Koel Testing Vol. 1',
                'artist' => 'Koel',
                'lyrics' => "When you wake up, turn your radio on, and you'll hear this simple song",
                'duration' => 10,
                'track' => 5,
            ],
        ]);

        /** @var Song $song */
        $song = Song::query()->where('path', 's3://koel/sample.mp3')->firstOrFail();

        self::assertSame('A Koel Song', $song->title);
        self::assertSame('Koel Testing Vol. 1', $song->album->name);
        self::assertSame('Koel', $song->artist->name);
        self::assertSame('When you wake up, turn your radio on, and you\'ll hear this simple song', $song->lyrics);
        self::assertSame(10, (int) $song->length);
        self::assertSame(5, $song->track);
    }

    public function testRemovingASong(): void
    {
        $this->expectsEvents(LibraryChanged::class);

        Song::factory()->create([
            'path' => 's3://koel/sample.mp3',
        ]);

        $this->delete('api/os/s3/song', [
            'bucket' => 'koel',
            'key' => 'sample.mp3',
        ]);

        self::assertDatabaseMissing(Song::class, ['path' => 's3://koel/sample.mp3']);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Tests\Feature\ObjectStorage;

use App\Events\LibraryChanged;
use App\Models\Song;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Tests\Feature\TestCase;

class S3Test extends TestCase
{
    use WithoutMiddleware;

    public function setUp(): void
    {
        parent::setUp();

        $this->disableMiddlewareForAllTests();
    }

    public function testStoringASong(): void
    {
        $this->post('api/os/s3/song', [
            'bucket' => 'koel',
            'key' => 'sample.mp3',
            'tags' => [
                'title' => 'A Koel Song',
                'album' => 'Koel Testing Vol. 1',
                'artist' => 'Koel',
                'lyrics' => "When you wake up, turn your radio on, and you'll hear this simple song",
                'duration' => 10,
                'track' => 5,
            ],
        ]);

        /** @var Song $song */
        $song = Song::query()->where('path', 's3://koel/sample.mp3')->firstOrFail();

        self::assertSame('A Koel Song', $song->title);
        self::assertSame('Koel Testing Vol. 1', $song->album->name);
        self::assertSame('Koel', $song->artist->name);
        self::assertSame('When you wake up, turn your radio on, and you\'ll hear this simple song', $song->lyrics);
        self::assertSame(10, (int) $song->length);
        self::assertSame(5, $song->track);
    }

    public function testRemovingASong(): void
    {
        $this->expectsEvents(LibraryChanged::class);

        Song::factory()->create([
            'path' => 's3://koel/sample.mp3',
        ]);

        $this->delete('api/os/s3/song', [
            'bucket' => 'koel',
            'key' => 'sample.mp3',
        ]);

        self::assertDatabaseMissing(Song::class, ['path' => 's3://koel/sample.mp3']);
    }
}

Function Calls

None

Variables

None

Stats

MD5 b96383688a6b80ec4f7861a5880d3bac
Eval Count 0
Decode Time 106 ms