@@ -110,6 +110,10 @@ public function test_upload_invalid_extension()
110
110
111
111
public function test_upload_valid_file ()
112
112
{
113
+ // Check icon does not yet appear in the html tags
114
+ $ crawler = self ::request ('GET ' , 'index.php ' );
115
+ $ this ->assertCount (0 , $ crawler ->filter ('link[rel="apple-touch-icon"] ' ));
116
+
113
117
$ this ->login ();
114
118
$ this ->admin_login ();
115
119
@@ -118,19 +122,28 @@ public function test_upload_valid_file()
118
122
// Ensure there was no error message rendered
119
123
$ this ->assertContainsLang ('ACP_PWA_IMG_UPLOAD_SUCCESS ' , $ crawler ->text ());
120
124
125
+ // Check icon appears in the ACP as expected
121
126
$ crawler = self ::request ('GET ' , 'adm/index.php?i=-phpbb-pwakit-acp-pwa_acp_module&mode=settings&sid= ' . $ this ->sid );
122
127
$ this ->assertStringContainsString ('foo.png ' , $ crawler ->filter ('fieldset ' )->eq (2 )->text ());
128
+
129
+ // Check icon appears in the html tags as expected
130
+ $ crawler = self ::request ('GET ' , 'index.php?sid= ' . $ this ->sid );
131
+ $ this ->assertStringContainsString ('foo.png ' , $ crawler ->filter ('link[rel="apple-touch-icon"] ' )->attr ('href ' ));
123
132
}
124
133
125
134
public function test_resync_delete_file ()
126
135
{
127
136
// Manually copy image to site icon dir
128
137
copy ($ this ->path . 'bar.png ' , __DIR__ . '/../../../../../images/site_icons/bar.png ' );
129
138
139
+ // Check icon does not appear in the html tags
140
+ $ crawler = self ::request ('GET ' , 'index.php ' );
141
+ $ this ->assertCount (0 , $ crawler ->filter ('link[rel="apple-touch-icon"] ' ));
142
+
130
143
$ this ->login ();
131
144
$ this ->admin_login ();
132
145
133
- // Ensure copied image does not yet appear
146
+ // Ensure copied image does not appear
134
147
$ crawler = self ::request ('GET ' , 'adm/index.php?i=-phpbb-pwakit-acp-pwa_acp_module&mode=settings&sid= ' . $ this ->sid );
135
148
$ this ->assertContainsLang ('ACP_PWA_KIT_NO_ICONS ' , $ crawler ->filter ('fieldset ' )->eq (2 )->html ());
136
149
@@ -139,13 +152,22 @@ public function test_resync_delete_file()
139
152
$ crawler = self ::submit ($ form );
140
153
$ this ->assertStringContainsString ('bar.png ' , $ crawler ->filter ('fieldset ' )->eq (2 )->text ());
141
154
155
+ // Check icon appears in the html tags as expected
156
+ $ crawler = self ::request ('GET ' , 'index.php?sid= ' . $ this ->sid );
157
+ $ this ->assertStringContainsString ('bar.png ' , $ crawler ->filter ('link[rel="apple-touch-icon"] ' )->attr ('href ' ));
158
+
142
159
// Delete image
160
+ $ crawler = self ::request ('GET ' , 'adm/index.php?i=-phpbb-pwakit-acp-pwa_acp_module&mode=settings&sid= ' . $ this ->sid );
143
161
$ form = $ crawler ->selectButton ('delete ' )->form (['delete ' => 'bar.png ' ]);
144
162
$ crawler = self ::submit ($ form );
145
163
$ form = $ crawler ->selectButton ('confirm ' )->form (['delete ' => 'bar.png ' ]);
146
164
$ crawler = self ::submit ($ form );
147
165
$ this ->assertStringContainsString ($ this ->lang ('ACP_PWA_IMG_DELETED ' , 'bar.png ' ), $ crawler ->text ());
148
166
$ crawler = self ::request ('GET ' , 'adm/index.php?i=-phpbb-pwakit-acp-pwa_acp_module&mode=settings&sid= ' . $ this ->sid );
149
167
$ this ->assertContainsLang ('ACP_PWA_KIT_NO_ICONS ' , $ crawler ->filter ('fieldset ' )->eq (2 )->html ());
168
+
169
+ // Check icon does not appear in the html tags
170
+ $ crawler = self ::request ('GET ' , 'index.php ' );
171
+ $ this ->assertCount (0 , $ crawler ->filter ('link[rel="apple-touch-icon"] ' ));
150
172
}
151
173
}
0 commit comments