diff --git tests/phpunit/testcases/core/avatars.php tests/phpunit/testcases/core/avatars.php
index d37fe1a..5383f64 100644
|
|
class BP_Tests_Avatars extends BP_UnitTestCase { |
204 | 204 | $classes = explode( ' ', $matches[1] ); |
205 | 205 | $this->assertSame( $expected, array_intersect_key( $expected, $classes ) ); |
206 | 206 | } |
| 207 | |
| 208 | /** |
| 209 | * @group bp_core_check_avatar_type |
| 210 | */ |
| 211 | public function test_bp_core_check_avatar_type() { |
| 212 | $file = array( |
| 213 | 'file' => array( |
| 214 | 'name' => 'buddypress_logo.pdf', |
| 215 | 'type' => 'application/pdf', |
| 216 | 'tmp_name' => BP_TESTS_DIR . 'assets/files/buddypress_logo.pdf', |
| 217 | ) |
| 218 | ); |
| 219 | |
| 220 | $this->assertFalse( bp_core_check_avatar_type( $file ) ); |
| 221 | |
| 222 | $file = array( |
| 223 | 'file' => array( |
| 224 | 'name' => 'disc.png', |
| 225 | 'type' => 'image/png', |
| 226 | 'tmp_name' => BP_TESTS_DIR . 'assets/files/disc.png', |
| 227 | ) |
| 228 | ); |
| 229 | |
| 230 | $this->assertTrue( bp_core_check_avatar_type( $file ) ); |
| 231 | |
| 232 | $file = array( |
| 233 | 'file' => array( |
| 234 | 'name' => 'disc.png', |
| 235 | 'type' => 'application/octet-stream', |
| 236 | 'tmp_name' => BP_TESTS_DIR . 'assets/files/disc.png', |
| 237 | ) |
| 238 | ); |
| 239 | |
| 240 | $this->assertTrue( bp_core_check_avatar_type( $file ), 'flash is using application/octet-stream for image uploads' ); |
| 241 | } |
207 | 242 | } |