Commit 67da6228 authored by Jacob Priddy's avatar Jacob Priddy 👌

Fix tests and change xdebug port

Make xdebug port default 9000
Fix some door access tests to be a little more comprehensive
parent c02562bd
Pipeline #12485 passed with stages
in 4 minutes and 10 seconds
......@@ -104,7 +104,6 @@ services:
- ./simple-saml-idp/config:/var/simplesamlphp-idp/config
- ./simple-saml-idp/metadata:/var/simplesamlphp-idp/metadata
ports:
- "9000:9000"
- "8000:8000"
logging:
options:
......
......@@ -4,7 +4,7 @@ display_errors = On
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.idekey="PHPSTORM"
xdebug.remote_port=9999
xdebug.remote_port=9000
xdebug.remote_autostart=1
# DockerNAT gateway IP
xdebug.remote.host=host.docker.internal
......
......@@ -9,6 +9,9 @@ use Source\Gateways\Groups\LocalGroupsRepository;
class LocalSchedulesRepository extends InMemorySchedulesRepository
{
/**
* @throws \Source\Exceptions\EntityNotFoundException
*/
public function __construct()
{
$this->create(new Schedule(
......
......@@ -4,8 +4,10 @@
namespace Tests\Feature\Door;
use Carbon\Carbon;
use Source\Entities\User;
use Source\Entities\Schedule;
use Illuminate\Testing\TestResponse;
use Source\Entities\HashedSearchable;
use Tests\Feature\AuthenticatesWithApplicationTestCase;
use Source\Gateways\DoorSchedule\DoorScheduleRepository;
use Source\Gateways\DoorSchedule\InMemoryDoorScheduleRepository;
......@@ -84,4 +86,51 @@ RSET;
$this->response->assertStatus(200);
}
/**
* @test
* @throws \Source\Exceptions\EntityExistsException
*/
public function it_denies_invalid_users(): void
{
$this->authenticateAsDoor();
$this->authorizer->setNext(true);
$this->handleTest('asdf');
$this->response->assertStatus(403);
}
/**
* @test
* @throws \Source\Exceptions\EntityExistsException
*/
public function it_denies_users_who_are_not_allowed(): void
{
$this->authenticateAsDoor();
$this->authorizer->setNext(false);
$this->handleTest('asdf');
$this->response->assertStatus(403);
}
/**
* @test
* @throws \Source\Exceptions\EntityExistsException
*/
public function it_allows_valid_users(): void
{
$this->authenticateAsDoor();
$this->usersRepository->create(new User(0, '', '', '', '', null, null, HashedSearchable::hash(config('app.key'), 'asdf')));
$this->authorizer->setNext(true);
$this->handleTest('asdf');
$this->response->assertStatus(200);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment