aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/avatar_acp_groups_test.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-07-17 23:55:20 +0200
committerMarc Alexander <admin@m-a-styles.de>2013-07-17 23:55:20 +0200
commit96989e536dd5fc603f3598fa7a2a50414331d76c (patch)
tree2c6f33516cb784ba9a9f37a4588e68d1c6f559a9 /tests/functional/avatar_acp_groups_test.php
parentbc6122b64ffb5c13c26991f78346fdc7dee6f9f0 (diff)
downloadforums-96989e536dd5fc603f3598fa7a2a50414331d76c.tar
forums-96989e536dd5fc603f3598fa7a2a50414331d76c.tar.gz
forums-96989e536dd5fc603f3598fa7a2a50414331d76c.tar.bz2
forums-96989e536dd5fc603f3598fa7a2a50414331d76c.tar.xz
forums-96989e536dd5fc603f3598fa7a2a50414331d76c.zip
[ticket/11531] Use abstract class for avatar tests and unify test cases
PHPBB3-11531
Diffstat (limited to 'tests/functional/avatar_acp_groups_test.php')
-rw-r--r--tests/functional/avatar_acp_groups_test.php152
1 files changed, 152 insertions, 0 deletions
diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php
new file mode 100644
index 0000000000..62b7409bdb
--- /dev/null
+++ b/tests/functional/avatar_acp_groups_test.php
@@ -0,0 +1,152 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/common_avatar_test.php';
+
+/**
+ * @group functional
+ */
+class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_avatar_test
+{
+ public function get_url()
+ {
+ return 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5';
+ }
+
+ public function avatar_acp_groups_data()
+ {
+ return array(
+ // Correct Gravatar
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_gravatar_email' => 'test@example.com',
+ 'avatar_gravatar_width' => 80,
+ 'avatar_gravatar_height' => 80,
+ ),
+ ),
+ // Gravatar with incorrect size
+ array(
+ 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_gravatar_email' => 'test@example.com',
+ 'avatar_gravatar_width' => 120,
+ 'avatar_gravatar_height' => 120,
+ ),
+ ),
+ // Incorrect email supplied for gravatar
+ array(
+ 'EMAIL_INVALID_EMAIL',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_gravatar_email' => 'test.example.com',
+ 'avatar_gravatar_width' => 80,
+ 'avatar_gravatar_height' => 80,
+ ),
+ ),
+ // Upload image from remote
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_upload',
+ array(
+ 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ ),
+ ),
+ // Incorrect URL
+ array(
+ 'AVATAR_URL_INVALID',
+ 'avatar_driver_upload',
+ array(
+ 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80',
+ ),
+ ),
+ /*
+ // Does not work due to DomCrawler issue
+ // Valid file upload
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_upload',
+ array(
+ 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'),
+ ),
+ ),
+ */
+ // Correct remote avatar
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_remote',
+ array(
+ 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ 'avatar_remote_width' => 80,
+ 'avatar_remote_height' => 80,
+ ),
+ ),
+ // Remote avatar with incorrect size
+ array(
+ 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.',
+ 'avatar_driver_remote',
+ array(
+ 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ 'avatar_remote_width' => 120,
+ 'avatar_remote_height' => 120,
+ ),
+ ),
+ // Wrong driver selected
+ array(
+ 'NO_AVATAR_SELECTED',
+ 'avatar_driver_upload',
+ array(
+ 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ 'avatar_remote_width' => 80,
+ 'avatar_remote_height' => 80,
+ ),
+ ),
+ // File does not exist, remote avatar currently does
+ // not check if file exists if size is specified
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_remote',
+ array(
+ 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ 'avatar_remote_width' => 80,
+ 'avatar_remote_height' => 80,
+ ),
+ ),
+ // File does not exist and remote avatar errors when
+ // trying to get the image size
+ array(
+ 'UNABLE_GET_IMAGE_SIZE',
+ 'avatar_driver_remote',
+ array(
+ 'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ 'avatar_remote_width' => '',
+ 'avatar_remote_height' => '',
+ ),
+ ),
+ // Delete avatar image to reset group settings
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_delete' => array('tick', ''),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider avatar_acp_groups_data
+ */
+ public function test_avatar_acp_groups($expected, $avatar_type, $data)
+ {
+ $this->assert_avatar_submit($expected, $avatar_type, $data);
+ }
+}