@@ -14,7 +14,7 @@ class MarkdownFormatterTest extends TestCase
1414 protected function setUp (): void
1515 {
1616 parent ::setUp ();
17- $ this ->formatter = new MarkdownFormatter () ;
17+ $ this ->formatter = new MarkdownFormatter ;
1818 }
1919
2020 public function test_formats_single_route (): void
@@ -34,9 +34,9 @@ public function test_formats_single_route(): void
3434
3535 $ this ->assertStringContainsString ('# API Documentation ' , $ result );
3636 $ this ->assertStringContainsString ('## GET /api/users ' , $ result );
37- $ this ->assertStringContainsString ('**Controller:** App\Http\Controllers\UserController ' , $ result );
38- $ this ->assertStringContainsString ('**Method :** index ' , $ result );
39- $ this ->assertStringContainsString ('**Description:** Retrieves a list of users. ' , $ result );
37+ $ this ->assertStringContainsString ('**Controller:** ` App\Http\Controllers\UserController@index` ' , $ result );
38+ $ this ->assertStringContainsString ('**Name :** `users. index` ' , $ result );
39+ $ this ->assertStringContainsString ('Retrieves a list of users. ' , $ result );
4040 }
4141
4242 public function test_formats_multiple_routes (): void
@@ -84,8 +84,7 @@ public function test_handles_closure_routes(): void
8484 $ result = $ this ->formatter ->format ($ documentation );
8585
8686 $ this ->assertStringContainsString ('## GET /api/health ' , $ result );
87- $ this ->assertStringContainsString ('**Controller:** Closure ' , $ result );
88- $ this ->assertStringContainsString ('**Method:** invoke ' , $ result );
87+ $ this ->assertStringContainsString ('**Controller:** `Closure@invoke` ' , $ result );
8988 }
9089
9190 public function test_handles_missing_descriptions (): void
@@ -103,7 +102,7 @@ public function test_handles_missing_descriptions(): void
103102
104103 $ result = $ this ->formatter ->format ($ documentation );
105104
106- $ this ->assertStringContainsString ('**Description:** No description available. ' , $ result );
105+ $ this ->assertStringContainsString ('No description available. ' , $ result );
107106 }
108107
109108 public function test_includes_timestamp (): void
@@ -112,8 +111,7 @@ public function test_includes_timestamp(): void
112111
113112 $ result = $ this ->formatter ->format ($ documentation );
114113
115- $ this ->assertStringContainsString ('Generated on: ' , $ result );
116- $ this ->assertStringContainsString (date ('Y-m-d H:i:s ' ), $ result );
114+ $ this ->assertStringContainsString ('Generated automatically by **digitalcorehub/laravel-api-docx**. ' , $ result );
117115 }
118116
119117 public function test_handles_empty_documentation (): void
@@ -123,10 +121,10 @@ public function test_handles_empty_documentation(): void
123121 $ result = $ this ->formatter ->format ($ documentation );
124122
125123 $ this ->assertStringContainsString ('# API Documentation ' , $ result );
126- $ this ->assertStringContainsString ('No API routes found . ' , $ result );
124+ $ this ->assertStringContainsString ('Generated automatically by **digitalcorehub/laravel-api-docx** . ' , $ result );
127125 }
128126
129- public function test_escapes_special_characters (): void
127+ public function test_handles_special_characters (): void
130128 {
131129 $ documentation = [
132130 [
@@ -142,6 +140,6 @@ public function test_escapes_special_characters(): void
142140 $ result = $ this ->formatter ->format ($ documentation );
143141
144142 $ this ->assertStringContainsString ('/api/users/{id} ' , $ result );
145- $ this ->assertStringNotContainsString ( ' <>&" \'' , $ result );
143+ $ this ->assertStringContainsString ( ' Retrieves a user with ID containing special chars: <>&" \'' , $ result );
146144 }
147145}
0 commit comments