Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 33
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
phpbb_functional_avatar_ucp_users_test
0.00% covered (danger)
0.00%
0 / 33
0.00% covered (danger)
0.00%
0 / 4
20
0.00% covered (danger)
0.00%
0 / 1
 get_url
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 avatar_ucp_groups_data
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
2
 test_avatar_ucp_groups
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 test_display_upload_avatar
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14require_once __DIR__ . '/common_avatar_test_case.php';
15
16/**
17 * @group functional
18 */
19class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_avatar_test_case
20{
21    public function get_url()
22    {
23        return 'ucp.php?i=ucp_profile&mode=avatar';
24    }
25
26    public static function avatar_ucp_groups_data()
27    {
28        return array(
29            // Gravatar with correct settings
30            array(
31                'PROFILE_UPDATED',
32                'avatar_driver_gravatar',
33                array(
34                    'avatar_gravatar_email'        => 'test@example.com',
35                    'avatar_gravatar_width'        => 80,
36                    'avatar_gravatar_height'    => 80,
37                ),
38            ),
39
40            array(
41                array('CONFIRM_AVATAR_DELETE', 'PROFILE_UPDATED'),
42                'avatar_driver_gravatar',
43                array(
44                    'avatar_delete'    => array('tick', ''),
45                ),
46            ),
47        );
48    }
49
50    /**
51    * @dataProvider avatar_ucp_groups_data
52    */
53    public function test_avatar_ucp_groups($expected, $avatar_type, $data)
54    {
55        $this->assert_avatar_submit($expected, $avatar_type, $data);
56    }
57
58    public function test_display_upload_avatar()
59    {
60        $this->assert_avatar_submit('PROFILE_UPDATED',
61            'avatar_driver_gravatar',
62            array(
63                'avatar_gravatar_email'        => 'test@example.com',
64                'avatar_gravatar_width'        => 80,
65                'avatar_gravatar_height'    => 80,
66            ),
67        );
68
69        $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid);
70        $avatar_link = $crawler->filter('img')->attr('src');
71        self::request('GET', $avatar_link . '&sid=' . $this->sid, array(), false);
72        $content = self::$client->getResponse()->getContent();
73        self::assertEquals(false, stripos(trim($content), 'debug'), 'Output contains debug message');
74    }
75}