Skip to content

Commit

Permalink
Include blueprint in augmented entry data (statamic#6015)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Varga <[email protected]>
  • Loading branch information
jacksleight and jasonvarga authored Aug 12, 2022
1 parent dcff6ca commit f7c410e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Entries/AugmentedEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private function commonKeys()
'order',
'is_entry',
'collection',
'blueprint',
'mount',
'locale',
'last_modified',
Expand Down
2 changes: 2 additions & 0 deletions tests/Data/Entries/AugmentedEntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Statamic\Facades\Blueprint;
use Statamic\Facades\Collection;
use Statamic\Facades\User;
use Statamic\Fields\Blueprint as FieldsBlueprint;
use Tests\Data\AugmentedTestCase;

class AugmentedEntryTest extends AugmentedTestCase
Expand Down Expand Up @@ -98,6 +99,7 @@ public function it_gets_values()
'order' => ['type' => 'null', 'value' => null], // todo: test for when this is an int
'is_entry' => ['type' => 'bool', 'value' => true],
'collection' => ['type' => CollectionContract::class, 'value' => $collection],
'blueprint' => ['type' => FieldsBlueprint::class, 'value' => $blueprint],
'mount' => ['type' => CollectionContract::class, 'value' => $mount],
'locale' => ['type' => 'string', 'value' => 'en'],
'last_modified' => ['type' => Carbon::class, 'value' => '2017-02-03 14:10'],
Expand Down
2 changes: 1 addition & 1 deletion tests/Data/Structures/AugmentedPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function it_gets_entry_keys()
// entry blueprint
'title', 'foo',
// augmented entry keys
'amp_url', 'api_url', 'collection', 'date', 'edit_url', 'id', 'origin_id', 'is_entry',
'amp_url', 'api_url', 'collection', 'blueprint', 'date', 'edit_url', 'id', 'origin_id', 'is_entry',
'last_modified', 'locale', 'mount', 'order', 'permalink', 'private',
'published', 'slug', 'status', 'updated_at', 'updated_by', 'uri', 'url',
// page blueprint
Expand Down
3 changes: 2 additions & 1 deletion tests/Data/Structures/PageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,12 @@ public function it_is_arrayable()
$this->assertInstanceOf(Arrayable::class, $page);

collect($arr = $page->toArray())
->except(['collection'])
->except(['collection', 'blueprint'])
->each(fn ($value, $key) => $this->assertEquals($value, $page->{$key}))
->each(fn ($value, $key) => $this->assertEquals($value, $page[$key]));

$this->assertEquals($page->collection()->toArray(), $arr['collection']);
$this->assertEquals($page->blueprint->toArray(), $arr['blueprint']);
}

protected function newTree()
Expand Down

0 comments on commit f7c410e

Please sign in to comment.