mirror of
https://github.com/jonathan-martz/pocketbase-php-sdk.git
synced 2026-04-03 07:27:42 +00:00
refactoring code, add doRequest via httpClient
This commit is contained in:
38
tests/AuthTest.php
Normal file
38
tests/AuthTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Pb\Collection;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class AuthTest extends TestCase
|
||||
{
|
||||
|
||||
private Collection $collection;
|
||||
private ?string $url;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->url = getenv('POCKETBASE_URL') ?: 'https://admin.pocketbase.dev';
|
||||
$this->collection = new Collection($this->url, 'users');
|
||||
}
|
||||
public function testAuthUser(): void
|
||||
{
|
||||
$this->expectException(ClientException::class);
|
||||
$this->collection->authAsUser('support@jonathan-martz.de', 'rockt');
|
||||
}
|
||||
|
||||
public function testAuthSuperUser(): void
|
||||
{
|
||||
$this->collection = new Collection($this->url, '_superusers');
|
||||
$this->expectException(ClientException::class);
|
||||
$this->collection->authAsAdmin('admin@jonathan-martz.de', 'rockt');
|
||||
}
|
||||
|
||||
public function testAuthSuperUser2(): void
|
||||
{
|
||||
$this->collection = new Collection($this->url, '_superusers');
|
||||
|
||||
$this->expectException(ClientException::class);
|
||||
$this->collection->authAsAdmin('admin@jmartz.de', 'rockt123?!');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user