Translation update done using Pootle.
[phpmyadmin/dkf.git] / test / PMA_isValid_test.php
blobffd41a26158820c2e1c885f1ce58bf9a075632ca
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * tests for PMA_pow()
6 * @package phpMyAdmin-test
7 */
9 /**
12 require_once 'PHPUnit/Framework.php';
13 require_once './libraries/core.lib.php';
15 /**
16 * @package phpMyAdmin-test
18 class PMA_isValid_test extends PHPUnit_Framework_TestCase
20 public function testVarNotSetAfterTest()
22 PMA_isValid($var);
23 $this->assertFalse(isset($var));
25 public function testNotSet()
27 $this->assertFalse(PMA_isValid($var));
29 public function testEmptyString()
31 $var = '';
32 $this->assertFalse(PMA_isValid($var));
34 public function testNotEmptyString()
36 $var = '0';
37 $this->assertTrue(PMA_isValid($var));
39 public function testZero()
41 $var = 0;
42 $this->assertTrue(PMA_isValid($var));
44 public function testNullFail()
46 $var = null;
47 $this->assertFalse(PMA_isValid($var));
49 public function testNotSetArray()
51 $this->assertFalse(PMA_isValid($array['x']));
53 public function testScalarString()
55 $var = 'string';
56 $this->assertTrue(PMA_isValid($var, 'scalar'));
58 public function testScalarInt()
60 $var = 1;
61 $this->assertTrue(PMA_isValid($var, 'scalar'));
63 public function testScalarFloat()
65 $var = 1.1;
66 $this->assertTrue(PMA_isValid($var, 'scalar'));
68 public function testScalarBool()
70 $var = true;
71 $this->assertTrue(PMA_isValid($var, 'scalar'));
73 public function testNotScalarArray()
75 $var = array('test');
76 $this->assertFalse(PMA_isValid($var, 'scalar'));
78 public function testNotScalarNull()
80 $var = null;
81 $this->assertFalse(PMA_isValid($var, 'scalar'));
83 public function testNumericInt()
85 $var = 1;
86 $this->assertTrue(PMA_isValid($var, 'numeric'));
88 public function testNumericFloat()
90 $var = 1.1;
91 $this->assertTrue(PMA_isValid($var, 'numeric'));
93 public function testNumericZero()
95 $var = 0;
96 $this->assertTrue(PMA_isValid($var, 'numeric'));
98 public function testNumericString()
100 $var = '+0.1';
101 $this->assertTrue(PMA_isValid($var, 'numeric'));
103 public function testValueInArray()
105 $var = 'a';
106 $this->assertTrue(PMA_isValid($var, array('a', 'b', )));
108 public function testValueNotInArray()
110 $var = 'c';
111 $this->assertFalse(PMA_isValid($var, array('a', 'b', )));