mirror of
https://github.com/jonathan-martz/pocketbase-php-sdk.git
synced 2026-04-03 07:27:42 +00:00
refactoring collection a little bit, adjust token from collection manual,write some test for the simple logic, fixing superusers authAdmin
This commit is contained in:
28
tests/CollectionGetFullListTest.php
Normal file
28
tests/CollectionGetFullListTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Pb\Collection;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class CollectionGetFullListTest extends TestCase
|
||||
{
|
||||
private string $url;
|
||||
private Collection $collection;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->url = getenv('POCKETBASE_URL') ?: 'https://admin.pocketbase.dev';
|
||||
$this->collection = new Collection($this->url, 'users');
|
||||
}
|
||||
|
||||
public function test_getFullList_gettingArrayWithOneUser(): void
|
||||
{
|
||||
$actual = $this->collection->getFullList([],100);
|
||||
|
||||
$this->assertArrayHasKey('items', $actual, 'Key "items" does not exist in the response.');
|
||||
$this->assertArrayHasKey('page', $actual, 'Key "page" does not exist in the response.');
|
||||
$this->assertArrayHasKey('perPage', $actual, 'Key "perPage" does not exist in the response.');
|
||||
$this->assertArrayHasKey('totalItems', $actual, 'Key "totalItems" does not exist in the response.');
|
||||
$this->assertArrayHasKey('totalPages', $actual, 'Key "totalPages" does not exist in the response.');
|
||||
$this->assertCount(1, $actual['items'], 'Expected no items in the response.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user