1
0
Fork 0
mirror of https://github.com/buddypress/buddypress.git synced 2026-07-21 20:54:17 +08:00
buddypress/tests/phpunit/testcases/notifications/template.php
Boone B Gorges 43e3f61722 Don't create a current user by default in most unit tests.
The default state of our tests should be as a logged-out user. BP does pretty
different things with different kinds of logged-in users, so individual tests
should decide for themselves what the current user status should be.

Moreover, the creation of fixture users is fairly resource-intensive. Not
creating users when they're not needed makes the test suite run 5-10% faster.

See #6009.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9561 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
2015-02-27 03:00:42 +00:00

74 lines
1.6 KiB
PHP

<?php
/**
* @group notifications
* @group template
*/
class BP_Tests_Notifications_Template extends BP_UnitTestCase {
/**
* @group pagination
* @group BP_Notifications_Template
*/
public function test_bp_notifications_template_should_give_precedence_to_npage_URL_param() {
$request = $_REQUEST;
$_REQUEST['npage'] = '5';
$at = new BP_Notifications_Template( array(
'page' => 8,
) );
$this->assertEquals( 5, $at->pag_page );
$_REQUEST = $request;
}
/**
* @group pagination
* @group BP_Notifications_Template
*/
public function test_bp_notifications_template_should_reset_0_pag_page_URL_param_to_default_pag_page_value() {
$request = $_REQUEST;
$_REQUEST['npage'] = '0';
$at = new BP_Notifications_Template( array(
'page' => 8,
) );
$this->assertEquals( 8, $at->pag_page );
$_REQUEST = $request;
}
/**
* @group pagination
* @group BP_Notifications_Template
*/
public function test_bp_notifications_template_should_give_precedence_to_num_URL_param() {
$request = $_REQUEST;
$_REQUEST['num'] = '14';
$at = new BP_Notifications_Template( array(
'per_page' => 13,
) );
$this->assertEquals( 14, $at->pag_num );
$_REQUEST = $request;
}
/**
* @group pagination
* @group BP_Notifications_Template
*/
public function test_bp_notifications_template_should_reset_0_pag_num_URL_param_to_default_pag_num_value() {
$request = $_REQUEST;
$_REQUEST['num'] = '0';
$at = new BP_Notifications_Template( array(
'per_page' => 13,
) );
$this->assertEquals( 13, $at->pag_num );
$_REQUEST = $request;
}
}