diff options
Diffstat (limited to 'tests/functional')
8 files changed, 49 insertions, 21 deletions
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 41bd48c204..37752b8fbb 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -19,6 +19,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c  	static protected $fixtures = array(  		'foo/bar/config/',  		'foo/bar/controller/', +		'foo/bar/event/', +		'foo/bar/language/en/',  		'foo/bar/styles/prosilver/template/',  	); diff --git a/tests/functional/extension_global_lang_test.php b/tests/functional/extension_global_lang_test.php index fb8f87e6de..094eda8257 100644 --- a/tests/functional/extension_global_lang_test.php +++ b/tests/functional/extension_global_lang_test.php @@ -17,8 +17,9 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_  	static private $helper;  	static protected $fixtures = array( -		'foo/bar/language/en/', +		'foo/bar/config/',  		'foo/bar/event/', +		'foo/bar/language/en/',  	);  	static public function setUpBeforeClass() diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php index 19adb89819..e922abdaf1 100644 --- a/tests/functional/extension_permission_lang_test.php +++ b/tests/functional/extension_permission_lang_test.php @@ -17,8 +17,9 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t  	static private $helper;  	static protected $fixtures = array( -		'foo/bar/language/en/', +		'foo/bar/config/',  		'foo/bar/event/', +		'foo/bar/language/en/',  	);  	static public function setUpBeforeClass() diff --git a/tests/functional/fixtures/ext/foo/bar/composer.json b/tests/functional/fixtures/ext/foo/bar/composer.json index cb9dbc9514..e3e5fc21cd 100644 --- a/tests/functional/fixtures/ext/foo/bar/composer.json +++ b/tests/functional/fixtures/ext/foo/bar/composer.json @@ -14,7 +14,7 @@  	}],  	"require": {  		"php": ">=5.3", -		"phpbb": "3.1.*@dev" +		"phpbb/phpbb": "3.1.*@dev"  	},  	"extra": {  		"display-name": "phpBB 3.1 Extension Testing" diff --git a/tests/functional/fixtures/ext/foo/bar/config/services.yml b/tests/functional/fixtures/ext/foo/bar/config/services.yml index 3bca4c6567..64e1163408 100644 --- a/tests/functional/fixtures/ext/foo/bar/config/services.yml +++ b/tests/functional/fixtures/ext/foo/bar/config/services.yml @@ -4,3 +4,12 @@ services:          arguments:              - @controller.helper              - @template +    foo_bar.listener.permission: +        class: foo\bar\event\permission +        tags: +            - { name: event.listener } +    foo_bar.listener.user_setup: +        class: foo\bar\event\user_setup +        tags: +            - { name: event.listener } + diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission.php b/tests/functional/fixtures/ext/foo/bar/event/permission.php index 92e24074ad..9b319dd35f 100644 --- a/tests/functional/fixtures/ext/foo/bar/event/permission.php +++ b/tests/functional/fixtures/ext/foo/bar/event/permission.php @@ -11,15 +11,6 @@  namespace foo\bar\event;  /** -* @ignore -*/ - -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/**  * Event listener  */  use Symfony\Component\EventDispatcher\EventSubscriberInterface; diff --git a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php index 1409f97470..8fa7ac97da 100644 --- a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php +++ b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php @@ -11,15 +11,6 @@  namespace foo\bar\event;  /** -* @ignore -*/ - -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/**  * Event listener  */  use Symfony\Component\EventDispatcher\EventSubscriberInterface; diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index 7f33ad1859..dd1b8ec981 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -52,4 +52,37 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case  			$this->assert_checkbox_is_unchecked($cplist, $checkbox_name);  		}  	} + +	public function test_mark_notifications_read() +	{ +		// Create a new standard user +		$this->create_user('notificationtestuser'); +		$this->add_user_group('NEWLY_REGISTERED', array('notificationtestuser')); +		$this->login('notificationtestuser'); +		$crawler = self::request('GET', 'index.php'); +		$this->assertContains('notificationtestuser', $crawler->filter('.icon-logout')->text()); + +		// Post a new post that needs approval +		$this->create_post(2, 1, 'Re: Welcome to phpBB3', 'This is a test [b]post[/b] posted by notificationtestuser.', array(), 'POST_STORED_MOD'); +		$crawler = self::request('GET', "viewtopic.php?t=1&sid={$this->sid}"); +		$this->assertNotContains('This is a test post posted by notificationtestuser.', $crawler->filter('html')->text()); + +		// logout +		$crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout'); + +		// admin login +		$this->login(); +		$this->add_lang('ucp'); +		$crawler = self::request('GET', 'ucp.php?i=ucp_notifications'); + +		// At least one notification should exist +		$this->assertGreaterThan(0, $crawler->filter('#notification_list_button strong')->text()); + +		// Get form token +		$link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri(); +		$crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); +		$form = $crawler->selectButton($this->lang('YES'))->form(); +		$crawler = self::submit($form); +		$this->assertEquals(0, $crawler->filter('#notification_list_button strong')->text()); +	}  }  | 
