summaryrefslogtreecommitdiff
path: root/tests/selenium/src/06-schema.php
blob: 346318f8ce7230020bfd6adb7c55f22c18e66690 (plain)
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
<?php
	$test_title = 'Schema tests';

	if (isset($_GET['run'])) {
		global $lang;
		require('../config.test.php');
		require('../testBuilder.class.php');
		/*
		 * 1/ create test schema
		 * 2/ alter its name, owner and comment
		 * NB: dropping the schema is in the cleantests.php tests
		 */
		$t = new TestBuilder($test_title,
			'Create and Alter schema.'
		);

		$t->login($admin_user, $admin_user_pass);

	/** 1 **/
		$t->addComment('1. create test schema');
		$t->clickAndWait("link={$lang['strdatabases']}");
		$t->clickAndWait("link={$testdb}");
		$t->clickAndWait("link={$lang['strschemas']}");
		$t->clickAndWait("link={$lang['strcreateschema']}");
		if ($t->data->hasAlterSchema()) {
			$t->type('formName', 'test_schema_toalter');
			if ($t->data->hasAlterSchemaOwner())
				$t->select('formAuth', $super_user[$t->server['desc']]);
			else $t->select('formAuth', $admin_user);
			$t->type('formComment', 'test schema comment to alter');
		}
		else {
			$t->type('formName', 'test_schema');
			$t->type('formComment', 'test schema comment');
		}
		$t->clickAndWait('create');
		$t->assertText('//p[@class=\'message\']', $lang['strschemacreated']);

	/** 2 **/
		$t->addComment('2. alter schema\'s name, owner and comment');
		if ($t->data->hasAlterSchema()) {
			$t->clickAndWait("link={$lang['strschemas']}");
			$t->clickAndWait("//tr/td/a[text()='test_schema_toalter']/../../td/a[text()='{$lang['stralter']}']");
			$t->type('name', 'test_schema');
			if ($t->data->hasAlterSchemaOwner())
				$t->select('owner', $admin_user);
			$t->type('comment', 'test schema');
			$t->clickAndWait('alter');
			$t->assertText('//p[@class=\'message\']', $lang['strschemaaltered']);
		}

		$t->logout();
		unset($t);
	}
?>