mirror of
https://github.com/jonathan-martz/pocketbase-php-sdk.git
synced 2026-04-03 07:27:42 +00:00
start with create collection item test
This commit is contained in:
29
tests/CollectionCreateTest.php
Normal file
29
tests/CollectionCreateTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Pb\Collection;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CollectionCreateTest 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 testCreateCollectionItem(){
|
||||
// $this->expectException(ClientException::class);
|
||||
// $this->collection->create(['name' => 'Hallo Welt']);
|
||||
}
|
||||
|
||||
public function testCreateCollectionItemAuthed(){
|
||||
$this->collection->authAsUser('admin@jmartz.de', 'rockt123?!');
|
||||
self::assertNotEmpty($this->collection::$token);
|
||||
// $response = $this->collection->create(['name' => 'Hallo Welt']);
|
||||
// var_dump($response);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user