Skip to content

Commit e4e4199

Browse files
authored
Merge pull request #22 from iMattPro/updates
Update tests
2 parents 14d5d43 + eb62f7c commit e4e4199

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/functional/acp_file_test.php

+23-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ public function test_upload_invalid_extension()
110110

111111
public function test_upload_valid_file()
112112
{
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+
113117
$this->login();
114118
$this->admin_login();
115119

@@ -118,19 +122,28 @@ public function test_upload_valid_file()
118122
// Ensure there was no error message rendered
119123
$this->assertContainsLang('ACP_PWA_IMG_UPLOAD_SUCCESS', $crawler->text());
120124

125+
// Check icon appears in the ACP as expected
121126
$crawler = self::request('GET', 'adm/index.php?i=-phpbb-pwakit-acp-pwa_acp_module&mode=settings&sid=' . $this->sid);
122127
$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'));
123132
}
124133

125134
public function test_resync_delete_file()
126135
{
127136
// Manually copy image to site icon dir
128137
copy($this->path . 'bar.png', __DIR__ . '/../../../../../images/site_icons/bar.png');
129138

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+
130143
$this->login();
131144
$this->admin_login();
132145

133-
// Ensure copied image does not yet appear
146+
// Ensure copied image does not appear
134147
$crawler = self::request('GET', 'adm/index.php?i=-phpbb-pwakit-acp-pwa_acp_module&mode=settings&sid=' . $this->sid);
135148
$this->assertContainsLang('ACP_PWA_KIT_NO_ICONS', $crawler->filter('fieldset')->eq(2)->html());
136149

@@ -139,13 +152,22 @@ public function test_resync_delete_file()
139152
$crawler = self::submit($form);
140153
$this->assertStringContainsString('bar.png', $crawler->filter('fieldset')->eq(2)->text());
141154

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+
142159
// Delete image
160+
$crawler = self::request('GET', 'adm/index.php?i=-phpbb-pwakit-acp-pwa_acp_module&mode=settings&sid=' . $this->sid);
143161
$form = $crawler->selectButton('delete')->form(['delete' => 'bar.png']);
144162
$crawler = self::submit($form);
145163
$form = $crawler->selectButton('confirm')->form(['delete' => 'bar.png']);
146164
$crawler = self::submit($form);
147165
$this->assertStringContainsString($this->lang('ACP_PWA_IMG_DELETED', 'bar.png'), $crawler->text());
148166
$crawler = self::request('GET', 'adm/index.php?i=-phpbb-pwakit-acp-pwa_acp_module&mode=settings&sid=' . $this->sid);
149167
$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"]'));
150172
}
151173
}

0 commit comments

Comments
 (0)