Build modified streamline images

The official image from streamline does not currently work for the arm64
platform. As a temporary measure, the source code and docker build scripts
have been lifted from the official images and are used to build locally.

Some additional modifications are made to reduce overall image size, these
are documented in docker/README.md
This commit is contained in:
2024-03-10 16:17:50 -07:00
parent 2ffc3c408a
commit a424394109
13506 changed files with 1860172 additions and 6 deletions
@@ -0,0 +1,174 @@
<?php
namespace Laravel\Ui\Tests\AuthBackend;
use Illuminate\Auth\Events\Attempting;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Routing\Pipeline;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Event;
use Illuminate\Testing\TestResponse;
use Illuminate\Validation\ValidationException;
use Orchestra\Testbench\Factories\UserFactory;
use Orchestra\Testbench\TestCase;
class AuthenticatesUsersTest extends TestCase
{
use AuthenticatesUsers;
protected function tearDown(): void
{
Auth::logout();
parent::tearDown();
}
/**
* Define database migrations.
*
* @return void
*/
protected function defineDatabaseMigrations()
{
$this->loadLaravelMigrations();
}
/** @test */
public function it_can_authenticate_a_user()
{
Event::fake();
$user = UserFactory::new()->create();
$request = Request::create('/login', 'POST', [
'email' => $user->email,
'password' => 'password',
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertStatus(204);
Event::assertDispatched(function (Attempting $event) {
return $event->remember === false;
});
}
/** @test */
public function it_can_authenticate_a_user_with_remember_as_false()
{
Event::fake();
$user = UserFactory::new()->create();
$request = Request::create('/login', 'POST', [
'email' => $user->email,
'password' => 'password',
'remember' => false,
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertStatus(204);
Event::assertDispatched(function (Attempting $event) {
return $event->remember === false;
});
}
/** @test */
public function it_can_authenticate_a_user_with_remember_as_true()
{
Event::fake();
$user = UserFactory::new()->create();
$request = Request::create('/login', 'POST', [
'email' => $user->email,
'password' => 'password',
'remember' => true,
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertStatus(204);
Event::assertDispatched(function (Attempting $event) {
return $event->remember === true;
});
}
/** @test */
public function it_cant_authenticate_a_user_with_invalid_password()
{
$user = UserFactory::new()->create();
$request = Request::create('/login', 'POST', [
'email' => $user->email,
'password' => 'invalid-password',
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertUnprocessable();
$this->assertInstanceOf(ValidationException::class, $response->exception);
$this->assertSame([
'email' => [
'These credentials do not match our records.',
],
], $response->exception->errors());
}
/** @test */
public function it_cant_authenticate_unknown_credential()
{
$request = Request::create('/login', 'POST', [
'email' => 'taylor@laravel.com',
'password' => 'password',
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertUnprocessable();
$this->assertInstanceOf(ValidationException::class, $response->exception);
$this->assertSame([
'email' => [
'These credentials do not match our records.',
],
], $response->exception->errors());
}
/**
* Handle Request using the following pipeline.
*
* @param \Illuminate\Http\Request $request
* @param callable $callback
* @return \Illuminate\Testing\TestResponse
*/
protected function handleRequestUsing(Request $request, callable $callback)
{
return new TestResponse(
(new Pipeline($this->app))
->send($request)
->through([
\Illuminate\Session\Middleware\StartSession::class,
])
->then($callback)
);
}
}