| 1 |
lars |
1 |
<?php
|
|
|
2 |
// $Id: admin_xml_test.php 174220 2004-12-07 15:34:23Z quipo $
|
|
|
3 |
|
|
|
4 |
require_once 'admin_db_test.php';
|
|
|
5 |
|
|
|
6 |
class TestOfAdminContainerXML extends TestOfAdminContainerDB {
|
|
|
7 |
function TestOfAdminContainerXML($name='Test of Admin Container XML') {
|
|
|
8 |
$this->UnitTestCase($name);
|
|
|
9 |
}
|
|
|
10 |
function setUp() {
|
|
|
11 |
$driver = 'XML';
|
|
|
12 |
$options = array(
|
|
|
13 |
'filename' => 'i18n.xml',
|
|
|
14 |
'save_on_shutdown' => false, //save in real time!
|
|
|
15 |
);
|
|
|
16 |
$this->tr =& Translation2_Admin::factory($driver, $options);
|
|
|
17 |
}
|
|
|
18 |
function tearDown() {
|
|
|
19 |
unset($this->tr);
|
|
|
20 |
}
|
|
|
21 |
function testAddLang() {
|
|
|
22 |
$langData = array(
|
|
|
23 |
'lang_id' => 'fr',
|
|
|
24 |
'name' => 'français',
|
|
|
25 |
'meta' => '123 abc',
|
|
|
26 |
'error_text' => 'non disponible',
|
|
|
27 |
'encoding' => 'iso-8859-1',
|
|
|
28 |
);
|
|
|
29 |
$pre = $this->tr->getLangs('array');
|
|
|
30 |
// create a new language
|
|
|
31 |
$this->tr->addLang($langData);
|
|
|
32 |
$post = $this->tr->getLangs('array');
|
|
|
33 |
$post = $this->tr->getLangs('array');
|
|
|
34 |
$expected = array(
|
|
|
35 |
'id' => 'fr',
|
|
|
36 |
'name' => 'français',
|
|
|
37 |
'meta' => '123 abc',
|
|
|
38 |
'error_text' => 'non disponible',
|
|
|
39 |
'encoding' => 'iso-8859-1',
|
|
|
40 |
);
|
|
|
41 |
$this->assertEqual($expected, array_pop(array_diff_assoc($post, $pre)));
|
|
|
42 |
// remove the new language
|
|
|
43 |
$this->assertTrue($this->tr->removeLang('fr'));
|
|
|
44 |
$this->assertEqual($pre, $this->tr->getLangs('array'));
|
|
|
45 |
}
|
|
|
46 |
}
|
|
|
47 |
?>
|