Newer
Older
Angie Byron
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* @file
* Contains \Drupal\Tests\Core\Batch\BatchNotFoundTest.
*/
namespace Drupal\Tests\Core\Batch;
use Drupal\simpletest\WebTestBase;
/**
* Tests if Drupal returns page not found error when batch ID does not exist.
*
* @group Batch
*/
class BatchNotFoundTest extends WebTestBase {
/**
* The main user for testing.
*
* @var object
*/
protected $userToBeDeleted;
/**
* Administrator user.
*
* @var object
*/
protected $adminUser;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('views');
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(array('administer users'));;
$this->userToBeDeleted = $this->drupalCreateUser();
}
/**
* Tests for page not found error if batch ID does not exist.
*/
public function testBatchNotFound() {
$this->drupalLogin($this->adminUser);
// Replicate a batch process by cancelling a user.
$edit = array(
'action' => 'user_cancel_user_action',
'user_bulk_form[2]' => TRUE,
);
$this->drupalPostForm('admin/people', $edit, t('Apply'));
$this->drupalPostForm(NULL, array(), t('Cancel accounts'));
$batch_id = db_next_id();
$this->drupalGet('batch', array(
'query' => array(
'op' => 'start',
'id' => $batch_id,
),
));
$this->assertResponse(404);
}
}