@@ -110,6 +110,51 @@ public function testQualifiedUrlAcceptsMultipleSchemes()
110
110
$ this ->assertSame ('http://example.com ' , $ this ->class ->url ());
111
111
}
112
112
113
+ public function testQualifiedUrlHelperWithAlreadyQualifiedUrl ()
114
+ {
115
+ $ this ->assertSame ('https://example.com/foo ' , $ this ->class ->url ('https://example.com/foo ' ));
116
+ $ this ->assertSame ('http://localhost/foo ' , $ this ->class ->url ('http://localhost/foo ' ));
117
+ }
118
+
119
+ public function testQualifiedUrlHelperWithAlreadyQualifiedUrlWhenSiteUrlIsSet ()
120
+ {
121
+ $ this ->app ['config ' ]->set (['hyde.url ' => 'https://example.com ' ]);
122
+
123
+ $ this ->assertSame ('https://example.com/foo ' , $ this ->class ->url ('https://example.com/foo ' ));
124
+ $ this ->assertSame ('http://localhost/foo ' , $ this ->class ->url ('http://localhost/foo ' ));
125
+ }
126
+
127
+ public function testQualifiedUrlHelperWithAlreadyQualifiedUrlWhenSiteUrlIsSetToSomethingElse ()
128
+ {
129
+ $ this ->app ['config ' ]->set (['hyde.url ' => 'my-site.com ' ]);
130
+
131
+ $ this ->assertSame ('https://example.com/foo ' , $ this ->class ->url ('https://example.com/foo ' ));
132
+ $ this ->assertSame ('http://localhost/foo ' , $ this ->class ->url ('http://localhost/foo ' ));
133
+ }
134
+
135
+ public function testQualifiedUrlHelperWithAlreadyQualifiedUrlStillFormatsPath ()
136
+ {
137
+ $ this ->assertSame ('https://example.com/foo/bar.html ' , $ this ->class ->url ('https://example.com/foo/bar.html ' ));
138
+ $ this ->assertSame ('http://localhost/foo/bar.html ' , $ this ->class ->url ('http://localhost/foo/bar.html ' ));
139
+ $ this ->assertSame ('http://localhost/foo/bar ' , $ this ->class ->url ('http://localhost/foo/bar/ ' ));
140
+ }
141
+
142
+ public function testQualifiedUrlHelperWithAlreadyQualifiedUrlStillFormatsPathWhenSiteUrlIsSet ()
143
+ {
144
+ $ this ->app ['config ' ]->set (['hyde.url ' => 'https://example.com ' ]);
145
+ $ this ->assertSame ('https://example.com/foo/bar.html ' , $ this ->class ->url ('https://example.com/foo/bar.html ' ));
146
+ $ this ->assertSame ('http://localhost/foo/bar.html ' , $ this ->class ->url ('http://localhost/foo/bar.html ' ));
147
+ $ this ->assertSame ('http://localhost/foo/bar ' , $ this ->class ->url ('http://localhost/foo/bar/ ' ));
148
+ }
149
+
150
+ public function testQualifiedUrlHelperWithAlreadyQualifiedUrlStillFormatsPathWithPrettyUrls ()
151
+ {
152
+ $ this ->app ['config ' ]->set (['hyde.url ' => 'https://example.com ' , 'hyde.pretty_urls ' => true ]);
153
+ $ this ->assertSame ('https://example.com/foo/bar ' , $ this ->class ->url ('https://example.com/foo/bar.html ' ));
154
+ $ this ->assertSame ('http://localhost/foo/bar ' , $ this ->class ->url ('http://localhost/foo/bar.html ' ));
155
+ $ this ->assertSame ('http://localhost/foo/bar ' , $ this ->class ->url ('http://localhost/foo/bar/ ' ));
156
+ }
157
+
113
158
public function testQualifiedUrlThrowsExceptionWhenNoSiteUrlIsSet ()
114
159
{
115
160
$ this ->withSiteUrl (null );
0 commit comments