|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
use Darksparrow\DeegraphInteractions\Exceptions\QueryBuilderConflictingFieldAlreadyExistsException;
|
|
|
|
use Darksparrow\DeegraphInteractions\QueryBuilder\QueryBuilder;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
final class QueryBuilderPutTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testPutURIAtSafeWithValidData()
|
|
|
|
{
|
|
|
|
$query = QueryBuilder::Put()
|
|
|
|
->URI("https://schemas.auxiliumsoftware.co.uk/v1/collection.json")
|
|
|
|
->At(relativePath: "{970334ed-1f4f-465a-94d7-923a99698786}/todos")
|
|
|
|
->Safe();
|
|
|
|
|
|
|
|
self::assertEquals(
|
|
|
|
expected: 'PUT URI "https://schemas.auxiliumsoftware.co.uk/v1/collection.json" AT {970334ed-1f4f-465a-94d7-923a99698786}/todos SAFE',
|
|
|
|
actual: $query->Build()->AsString(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
public function testPutWithBothThings()
|
|
|
|
{
|
|
|
|
$this->expectException(QueryBuilderConflictingFieldAlreadyExistsException::class);
|
|
|
|
$query = QueryBuilder::Put()
|
|
|
|
->URI("https://schemas.auxiliumsoftware.co.uk/v1/collection.json")
|
|
|
|
->At(relativePath: "{970334ed-1f4f-465a-94d7-923a99698786}/todos")
|
|
|
|
->Into(relativePath: "Relative Path", propertyName: "OwO")
|
|
|
|
->Safe();
|
|
|
|
}
|
|
|
|
}
|