Skip to content

Commit 29cf327

Browse files
committed
add more tasks tests
1 parent f142038 commit 29cf327

2 files changed

Lines changed: 93 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Class Select_Locale_Test
4+
*
5+
* @package Progress_Planner
6+
*/
7+
8+
namespace Progress_Planner\Tests;
9+
10+
/**
11+
* Select locale test case.
12+
*/
13+
class Select_Locale_Test extends \WP_UnitTestCase {
14+
15+
use Task_Provider_Test_Trait;
16+
17+
/**
18+
* The task provider ID.
19+
*
20+
* @var string
21+
*/
22+
protected $task_provider_id = 'select-locale';
23+
24+
/**
25+
* Setup the test.
26+
*
27+
* @return void
28+
*/
29+
public static function setUpBeforeClass(): void { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
30+
// Set the browser locale to something different from WP's en_US.
31+
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr-FR,fr;q=0.9';
32+
33+
// Set the current user to the admin user.
34+
\wp_set_current_user( 1 );
35+
}
36+
37+
/**
38+
* Tear down the test.
39+
*
40+
* @return void
41+
*/
42+
public static function tearDownAfterClass(): void { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
43+
unset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] );
44+
45+
// Reset the current user.
46+
\wp_set_current_user( 0 );
47+
}
48+
49+
/**
50+
* Complete the task.
51+
*
52+
* @return void
53+
*/
54+
protected function complete_task() {
55+
$activity = new \Progress_Planner\Activities\Suggested_Task();
56+
$activity->data_id = 'select-locale';
57+
$activity->save();
58+
}
59+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Class Select_Timezone_Test
4+
*
5+
* @package Progress_Planner
6+
*/
7+
8+
namespace Progress_Planner\Tests;
9+
10+
/**
11+
* Select timezone test case.
12+
*/
13+
class Select_Timezone_Test extends \WP_UnitTestCase {
14+
15+
use Task_Provider_Test_Trait;
16+
17+
/**
18+
* The task provider ID.
19+
*
20+
* @var string
21+
*/
22+
protected $task_provider_id = 'select-timezone';
23+
24+
/**
25+
* Complete the task.
26+
*
27+
* @return void
28+
*/
29+
protected function complete_task() {
30+
$activity = new \Progress_Planner\Activities\Suggested_Task();
31+
$activity->data_id = 'select-timezone';
32+
$activity->save();
33+
}
34+
}

0 commit comments

Comments
 (0)