@@ -76,6 +76,8 @@ public function it_gets_values()
7676 ->setSupplement ('three ' , 'the "three" value supplemented on the entry ' )
7777 ->setSupplement ('four ' , 'the "four" value supplemented on the entry and in the blueprint ' );
7878
79+ $ mount = tap (Collection::make ('mountable ' )->mount ($ entry ->id ()))->save ();
80+
7981 $ augmented = new AugmentedEntry ($ entry );
8082
8183 $ expectations = [
@@ -93,6 +95,7 @@ public function it_gets_values()
9395 'order ' => ['type ' => 'null ' , 'value ' => null ], // todo: test for when this is an int
9496 'is_entry ' => ['type ' => 'bool ' , 'value ' => true ],
9597 'collection ' => ['type ' => CollectionContract::class, 'value ' => $ collection ],
98+ 'mount ' => ['type ' => CollectionContract::class, 'value ' => $ mount ],
9699 'last_modified ' => ['type ' => Carbon::class, 'value ' => '2017-02-03 14:10 ' ],
97100 'updated_at ' => ['type ' => Carbon::class, 'value ' => '2017-02-03 14:10 ' ],
98101 'updated_by ' => ['type ' => UserContract::class, 'value ' => 'test-user ' ],
@@ -109,4 +112,25 @@ public function it_gets_values()
109112
110113 $ this ->assertAugmentedCorrectly ($ expectations , $ augmented );
111114 }
115+
116+ /** @test */
117+ public function it_gets_the_mount_from_the_value_first_if_it_exists ()
118+ {
119+ $ mount = tap (Collection::make ('a ' ))->save ();
120+
121+ $ entry = EntryFactory::id ('entry-id ' )
122+ ->collection ('test ' )
123+ ->slug ('entry-slug ' )
124+ ->create ();
125+
126+ $ augmented = new AugmentedEntry ($ entry );
127+
128+ $ this ->assertNull ($ augmented ->get ('mount ' ));
129+
130+ $ mount ->mount ($ entry ->id ())->save ();
131+ $ this ->assertEquals ($ mount , $ augmented ->get ('mount ' ));
132+
133+ $ entry ->set ('mount ' , 'b ' );
134+ $ this ->assertEquals ('b ' , $ augmented ->get ('mount ' ));
135+ }
112136}
0 commit comments