Skip to content

Commit

Permalink
Set the scope indentifier when creating the scope (#38) (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianBustamante authored and freekmurze committed Oct 8, 2018
1 parent 83e208c commit 9fe897f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Fractal.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public function createData()
$this->manager->parseFieldsets($this->fieldsets);
}

return $this->manager->createData($this->getResource());
return $this->manager->createData($this->getResource(), $this->resourceName);
}

/**
Expand Down
17 changes: 17 additions & 0 deletions tests/ScopeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Spatie\Fractalistic\Test;

class ScopeTest extends TestCase
{
/** @test */
public function it_uses_an_identifier_for_the_scope()
{
$scope = $this->fractal
->collection($this->testBooks, new TestTransformer(), 'books')
->parseIncludes('characters')
->createData();

$this->assertEquals('books', $scope->getIdentifier());
}
}

0 comments on commit 9fe897f

Please sign in to comment.