File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of https://github.com/josantonius/php-json repository.
5+ *
6+ * (c) Josantonius <hello@josantonius.dev>
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ *
11+ * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+ */
13+
14+ namespace Josantonius \Json \Tests ;
15+
16+ use Josantonius \Json \Json ;
17+ use PHPUnit \Framework \TestCase ;
18+
19+ class FilepathMethodTest extends TestCase
20+ {
21+ private string $ filepath = __DIR__ . '/filename.json ' ;
22+
23+ private string $ url = 'https://raw.githubusercontent.com/josantonius/php-json/main/composer.json ' ;
24+
25+ public function setUp (): void
26+ {
27+ parent ::setup ();
28+ }
29+
30+ public function tearDown (): void
31+ {
32+ if (file_exists ($ this ->filepath )) {
33+ unlink ($ this ->filepath );
34+ }
35+ }
36+
37+ public function test_should_get_the_path_to_a_local_file (): void
38+ {
39+ $ jsonFile = new Json ($ this ->filepath );
40+
41+ $ this ->assertEquals ($ this ->filepath , $ jsonFile ->filepath ());
42+ }
43+
44+ public function test_should_get_the_path_to_a_remote_file (): void
45+ {
46+ $ jsonFile = new Json ($ this ->url );
47+
48+ $ this ->assertEquals ($ this ->url , $ jsonFile ->filepath ());
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments