|
13 | 13 | use Hyde\Framework\HydeServiceProvider; |
14 | 14 | use Hyde\Hyde; |
15 | 15 | use Hyde\Pages\BladePage; |
| 16 | +use Hyde\Pages\Concerns\HydePage; |
16 | 17 | use Hyde\Pages\DocumentationPage; |
17 | 18 | use Hyde\Pages\InMemoryPage; |
18 | 19 | use Hyde\Pages\MarkdownPage; |
@@ -79,17 +80,24 @@ public function test_has_feature_helper_calls_method_on_features_class() |
79 | 80 |
|
80 | 81 | public function test_current_page_helper_returns_current_page_name() |
81 | 82 | { |
82 | | - Render::share('currentPage', 'foo'); |
83 | | - $this->assertSame('foo', Hyde::currentPage()); |
| 83 | + Render::share('routeKey', 'foo'); |
| 84 | + $this->assertSame('foo', Hyde::currentRouteKey()); |
84 | 85 | } |
85 | 86 |
|
86 | 87 | public function test_current_route_helper_returns_current_route_object() |
87 | 88 | { |
88 | 89 | $expected = new Route(new MarkdownPage()); |
89 | | - Render::share('currentRoute', $expected); |
| 90 | + Render::share('route', $expected); |
90 | 91 | $this->assertInstanceOf(Route::class, Hyde::currentRoute()); |
91 | 92 | $this->assertSame($expected, Hyde::currentRoute()); |
92 | | - $this->assertSame($expected, Hyde::currentRoute()); |
| 93 | + } |
| 94 | + |
| 95 | + public function test_current_page_helper_returns_current_page_object() |
| 96 | + { |
| 97 | + $expected = new MarkdownPage(); |
| 98 | + Render::share('page', $expected); |
| 99 | + $this->assertInstanceOf(HydePage::class, Hyde::currentPage()); |
| 100 | + $this->assertSame($expected, Hyde::currentPage()); |
93 | 101 | } |
94 | 102 |
|
95 | 103 | public function test_make_title_helper_returns_title_from_page_slug() |
@@ -151,29 +159,29 @@ public function test_format_html_path_helper_formats_path_according_to_config_ru |
151 | 159 |
|
152 | 160 | public function test_relative_link_helper_returns_relative_link_to_destination() |
153 | 161 | { |
154 | | - Render::share('currentPage', 'bar'); |
| 162 | + Render::share('routeKey', 'bar'); |
155 | 163 | $this->assertSame('foo', Hyde::relativeLink('foo')); |
156 | 164 |
|
157 | | - Render::share('currentPage', 'foo/bar'); |
| 165 | + Render::share('routeKey', 'foo/bar'); |
158 | 166 | $this->assertSame('../foo', Hyde::relativeLink('foo')); |
159 | 167 | } |
160 | 168 |
|
161 | 169 | public function test_media_link_helper_returns_relative_link_to_destination() |
162 | 170 | { |
163 | | - Render::share('currentPage', 'bar'); |
| 171 | + Render::share('routeKey', 'bar'); |
164 | 172 | $this->assertSame('media/foo', Hyde::mediaLink('foo')); |
165 | 173 |
|
166 | | - Render::share('currentPage', 'foo/bar'); |
| 174 | + Render::share('routeKey', 'foo/bar'); |
167 | 175 | $this->assertSame('../media/foo', Hyde::mediaLink('foo')); |
168 | 176 | } |
169 | 177 |
|
170 | 178 | public function test_image_helper_returns_image_path_for_given_name() |
171 | 179 | { |
172 | | - Render::share('currentPage', 'foo'); |
| 180 | + Render::share('routeKey', 'foo'); |
173 | 181 | $this->assertSame('media/foo.jpg', Hyde::asset('foo.jpg')); |
174 | 182 | $this->assertSame('https://example.com/foo.jpg', Hyde::asset('https://example.com/foo.jpg')); |
175 | 183 |
|
176 | | - Render::share('currentPage', 'foo/bar'); |
| 184 | + Render::share('routeKey', 'foo/bar'); |
177 | 185 | $this->assertSame('../media/foo.jpg', Hyde::asset('foo.jpg')); |
178 | 186 | $this->assertSame('https://example.com/foo.jpg', Hyde::asset('https://example.com/foo.jpg')); |
179 | 187 | } |
|
0 commit comments