Skip to content

Commit 79974ca

Browse files
committed
make getResource public
1 parent 32602c8 commit 79974ca

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All Notable changes to `laravel-fractal` will be documented in this file
44

5+
## 1.1.0 - 2015-10-08
6+
7+
### Changed
8+
- Made the `getResource`-function public
9+
510
## 1.0.0 - 2015-10-07
611

712
### Added

src/Fractal.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ protected function transform($conversionMethod)
168168
/**
169169
* Get the resource.
170170
*
171-
* @return \League\Fractal\Resource\Collection
171+
* @return \League\Fractal\Resource\ResourceInterface
172172
*
173173
* @throws \Spatie\Fractal\Exceptions\InvalidTransformation
174174
*/
175-
protected function getResource()
175+
public function getResource()
176176
{
177177
$resourceClass = 'League\\Fractal\\Resource\\'.ucfirst($this->dataType);
178178

tests/Integration/FractalTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,16 @@ public function it_can_perform_a_single_item()
8585

8686
$this->assertEquals($expectedArray, $array);
8787
}
88+
89+
/**
90+
* @test
91+
*/
92+
public function it_can_create_a_resource()
93+
{
94+
$resource = $this->fractal
95+
->collection($this->testBooks, new TestTransformer())
96+
->getResource();
97+
98+
$this->assertInstanceOf(\League\Fractal\Resource\ResourceInterface::class, $resource);
99+
}
88100
}

0 commit comments

Comments
 (0)