Skip to content

Commit

Permalink
Ensure resource types are presented correctly in list response (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
arietimmerman authored Sep 30, 2024
1 parent 2f219c4 commit fa60195
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function prepareReturn(Arrayable $object, ResourceType $resourceTy
public static function objectToSCIMArray($object, ResourceType $resourceType = null, array $attributes = [])
{
if($resourceType == null){
return $object;
return $object instanceof Arrayable ? $object->toArray() : $object;
}

$mapping = $resourceType->getMapping();
Expand Down
3 changes: 2 additions & 1 deletion src/SCIM/ResourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace ArieTimmerman\Laravel\SCIMServer\SCIM;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;

class ResourceType implements Jsonable
class ResourceType implements Jsonable, Arrayable
{
public $id;

Expand Down
20 changes: 20 additions & 0 deletions tests/ResourceTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@ public function testGet()
{
$response = $this->get('/scim/v2/ResourceTypes');
$response->assertStatus(200);

$response->assertJsonStructure([
'schemas',
'totalResults',
'Resources' => [
'*' => [
'schemas',
'id',
'name',
'endpoint',
'description',
'schema',
'schemaExtensions',
'meta' => [
'location',
'resourceType'
]
]
]
]);
}

public function testGetOne(){
Expand Down

0 comments on commit fa60195

Please sign in to comment.