File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,6 +129,58 @@ public function test_path_is_not_absolute() {
129129 }
130130 }
131131
132+ /**
133+ * Tests path_join().
134+ *
135+ * @ticket 55897
136+ * @dataProvider path_join_data_provider
137+ */
138+ public function test_path_join ( $ base , $ path , $ expected ) {
139+ $ this ->assertSame ( $ expected , path_join ( $ base , $ path ) );
140+ }
141+
142+ /**
143+ * Data provider for test_path_join().
144+ *
145+ * @return string[][]
146+ */
147+ public function path_join_data_provider () {
148+ return array (
149+ // Absolute path.
150+ 'absolute path should return path ' => array (
151+ 'base ' => 'base ' ,
152+ 'path ' => '/path ' ,
153+ 'expected ' => '/path ' ,
154+ ),
155+ // Non-absolute paths.
156+ 'join base and path ' => array (
157+ 'base ' => 'base ' ,
158+ 'path ' => 'path ' ,
159+ 'expected ' => 'base/path ' ,
160+ ),
161+ 'strip trailing slashes in base ' => array (
162+ 'base ' => 'base/// ' ,
163+ 'path ' => 'path ' ,
164+ 'expected ' => 'base/path ' ,
165+ ),
166+ 'empty path ' => array (
167+ 'base ' => 'base ' ,
168+ 'path ' => '' ,
169+ 'expected ' => 'base/ ' ,
170+ ),
171+ 'empty base ' => array (
172+ 'base ' => '' ,
173+ 'path ' => 'path ' ,
174+ 'expected ' => '/path ' ,
175+ ),
176+ 'empty path and base ' => array (
177+ 'base ' => '' ,
178+ 'path ' => '' ,
179+ 'expected ' => '/ ' ,
180+ ),
181+ );
182+ }
183+
132184 /**
133185 * @ticket 33265
134186 * @ticket 35996
You can’t perform that action at this time.
0 commit comments