Ticket #4029: 4029.testcases.diff
File 4029.testcases.diff, 2.7 KB (added by , 17 years ago) |
---|
-
test_includes_functions.php
9 9 10 10 function tearDown() { 11 11 parent::tearDown(); 12 } 13 14 function test_maybe_serialize_array_should_be_serialized() 15 { 16 $data = array(); 17 18 $actual = maybe_serialize($data); 19 20 $this->assertTrue( is_string($data) ); 21 $this->assertEquals($actual, serialize($data) ); 22 } 23 24 function test_maybe_serialize_string_should_not_be_serialized() 25 { 26 $data = 'thisisatest'; 27 28 $actual = maybe_serialize($data); 29 30 $this->assertEquals($actual, $data ); 31 } 32 33 function test_maybe_serialized_string_should_be_serialized() 34 { 35 $data = serialize(array()); 36 37 $actual = maybe_serialize($data); 38 39 $this->assertEquals($actual, serialize($data) ); 40 } 41 42 function test_maybe_serialize_integer_should_not_be_serialized() 43 { 44 $data = 10; 45 46 $actual = maybe_serialize($data); 47 48 $this->assertEquals($actual, $data ); 12 49 } 13 50 14 51 function test_wp_parse_args_object() { … … 19 56 $this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x)); 20 57 $y = new MockClass; 21 58 $this->assertEquals(array(), wp_parse_args($y)); 22 } 59 } 60 23 61 function test_wp_parse_args_array() { 24 62 // arrays 25 63 $a = array(); 26 64 $this->assertEquals(array(), wp_parse_args($x)); 27 65 $b = array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')); 28 66 $this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($b)); 29 } 67 } 68 30 69 function test_wp_parse_args_defaults() { 31 70 $x = new MockClass; 32 71 $x->_baba = 5; … … 36 75 $this->assertEquals(array('pu' => 'bu', '_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x, $d)); 37 76 $e = array('_baba' => 6); 38 77 $this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x, $e)); 39 } 78 } 79 40 80 function test_wp_parse_args_other() { 41 81 $b = true; 42 82 wp_parse_str($b, $s); … … 44 84 $q = 'x=5&_baba=dudu&'; 45 85 wp_parse_str($q, $ss); 46 86 $this->assertEquals($ss, wp_parse_args($q)); 47 } 87 } 88 48 89 function test_size_format() { 49 90 $this->knownWPBug(5246); 50 91 $kb = 1024; … … 65 106 $this->assertFalse(size_format('baba')); 66 107 $this->assertFalse(size_format(array())); 67 108 } 68 109 69 110 function test_path_is_absolute() { 70 111 if ( !is_callable('path_is_absolute') ) 71 112 $this->markTestSkipped(); … … 106 147 $this->assertFalse( path_is_absolute($path), "path_is_absolute('$path') should return false" ); 107 148 } 108 149 109 110 150 function test_wp_unique_filename() { 111 151 $this->knownWPBug(6294); 112 152