Decoded Output
Download<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
class ProfileTest extends TestCase
{
public function testUpdateProfileRequiresCurrentPassword(): void
{
$this->putAs('api/me', [
'name' => 'Foo',
'email' => '[email protected]',
])
->assertUnprocessable();
}
public function testUpdateProfileWithoutNewPassword(): void
{
/** @var User $user */
$user = User::factory()->create(['password' => Hash::make('secret')]);
$this->putAs('api/me', [
'name' => 'Foo',
'email' => '[email protected]',
'current_password' => 'secret',
], $user);
$user->refresh();
self::assertSame('Foo', $user->name);
self::assertSame('[email protected]', $user->email);
self::assertTrue(Hash::check('secret', $user->password));
}
public function testUpdateProfileWithNewPassword(): void
{
/** @var User $user */
$user = User::factory()->create(['password' => Hash::make('secret')]);
$token = $this->putAs('api/me', [
'name' => 'Foo',
'email' => '[email protected]',
'new_password' => 'new-secret',
'current_password' => 'secret',
], $user)
->headers
->get('Authorization');
$user->refresh();
self::assertNotNull($token);
self::assertSame('Foo', $user->name);
self::assertSame('[email protected]', $user->email);
self::assertTrue(Hash::check('new-secret', $user->password));
}
}
?>
Did this file decode correctly?
How would you describe this file?
Thank you for your feedback! This will help us detect malicious PHP files more accurately in the future.
Function Calls
None
Variables
None
Stats
| MD5 | 52892721541db39a |
|---|---|
| Eval Count | 0 |
| Decode Time | 107 ms |
Original Code
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
class ProfileTest extends TestCase
{
public function testUpdateProfileRequiresCurrentPassword(): void
{
$this->putAs('api/me', [
'name' => 'Foo',
'email' => '[email protected]',
])
->assertUnprocessable();
}
public function testUpdateProfileWithoutNewPassword(): void
{
/** @var User $user */
$user = User::factory()->create(['password' => Hash::make('secret')]);
$this->putAs('api/me', [
'name' => 'Foo',
'email' => '[email protected]',
'current_password' => 'secret',
], $user);
$user->refresh();
self::assertSame('Foo', $user->name);
self::assertSame('[email protected]', $user->email);
self::assertTrue(Hash::check('secret', $user->password));
}
public function testUpdateProfileWithNewPassword(): void
{
/** @var User $user */
$user = User::factory()->create(['password' => Hash::make('secret')]);
$token = $this->putAs('api/me', [
'name' => 'Foo',
'email' => '[email protected]',
'new_password' => 'new-secret',
'current_password' => 'secret',
], $user)
->headers
->get('Authorization');
$user->refresh();
self::assertNotNull($token);
self::assertSame('Foo', $user->name);
self::assertSame('[email protected]', $user->email);
self::assertTrue(Hash::check('new-secret', $user->password));
}
}