Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/tests/user/views_user_argument_validate.test | ||
---|---|---|
24 | 24 |
|
25 | 25 |
function testArgumentValidateUserUid() { |
26 | 26 |
$account = $this->account; |
27 |
// test 'uid' case |
|
27 |
// test 'uid' case.
|
|
28 | 28 |
$view = $this->view_argument_validate_user('uid'); |
29 | 29 |
$view->set_display('default'); |
30 | 30 |
$view->pre_execute(); |
... | ... | |
36 | 36 |
$this->assertFalse($view->argument['null']->validate_arg($account->name)); |
37 | 37 |
// Reset safed argument validation. |
38 | 38 |
$view->argument['null']->argument_validated = NULL; |
39 |
// Fail for a valid numeric, but for a user that doesn't exist |
|
39 |
// Fail for a valid numeric, but for a user that doesn't exist.
|
|
40 | 40 |
$this->assertFalse($view->argument['null']->validate_arg(32)); |
41 | 41 |
} |
42 | 42 |
|
43 | 43 |
function testArgumentValidateUserName() { |
44 | 44 |
$account = $this->account; |
45 |
// test 'name' case |
|
45 |
// test 'name' case.
|
|
46 | 46 |
$view = $this->view_argument_validate_user('name'); |
47 | 47 |
$view->set_display('default'); |
48 | 48 |
$view->pre_execute(); |
... | ... | |
54 | 54 |
$this->assertFalse($view->argument['null']->validate_arg($account->uid)); |
55 | 55 |
// Reset safed argument validation. |
56 | 56 |
$view->argument['null']->argument_validated = NULL; |
57 |
// Fail for a valid string, but for a user that doesn't exist |
|
57 |
// Fail for a valid string, but for a user that doesn't exist.
|
|
58 | 58 |
$this->assertFalse($view->argument['null']->validate_arg($this->randomName())); |
59 | 59 |
} |
60 | 60 |
|
61 | 61 |
function testArgumentValidateUserEither() { |
62 | 62 |
$account = $this->account; |
63 |
// test 'either' case |
|
63 |
// test 'either' case.
|
|
64 | 64 |
$view = $this->view_argument_validate_user('either'); |
65 | 65 |
$view->set_display('default'); |
66 | 66 |
$view->pre_execute(); |
... | ... | |
72 | 72 |
$this->assertTrue($view->argument['null']->validate_arg($account->uid)); |
73 | 73 |
// Reset safed argument validation. |
74 | 74 |
$view->argument['null']->argument_validated = NULL; |
75 |
// Fail for a valid string, but for a user that doesn't exist |
|
75 |
// Fail for a valid string, but for a user that doesn't exist.
|
|
76 | 76 |
$this->assertFalse($view->argument['null']->validate_arg($this->randomName())); |
77 | 77 |
// Reset safed argument validation. |
78 | 78 |
$view->argument['null']->argument_validated = NULL; |
79 |
// Fail for a valid uid, but for a user that doesn't exist |
|
79 |
// Fail for a valid uid, but for a user that doesn't exist.
|
|
80 | 80 |
$this->assertFalse($view->argument['null']->validate_arg(32)); |
81 | 81 |
} |
82 | 82 |
|
83 | 83 |
function view_argument_validate_user($argtype) { |
84 |
$view = new view; |
|
84 |
$view = new view();
|
|
85 | 85 |
$view->name = 'view_argument_validate_user'; |
86 | 86 |
$view->description = ''; |
87 | 87 |
$view->tag = ''; |
Formats disponibles : Unified diff
Weekly update of contrib modules