Changeset 43035 for branches/4.9/tests/phpunit/tests/compat.php
- Timestamp:
- 04/30/2018 03:46:07 AM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/tests/phpunit/tests/compat.php
r32364 r43035 187 187 $this->assertEquals( array( 'foo' ), $json->decode( '["foo"]' ) ); 188 188 } 189 190 /** 191 * @ticket 43583 192 */ 193 function test_is_countable_availability() { 194 $this->assertTrue( function_exists( 'is_countable' ) ); 195 } 196 197 /** 198 * Test is_countable() polyfill. 199 * 200 * @ticket 43583 201 * 202 * @dataProvider countable_variable_test_data 203 */ 204 function test_is_countable_functionality( $variable, $is_countable ) { 205 $this->assertEquals( is_countable( $variable ), $is_countable ); 206 } 207 208 /** 209 * Data provider for test_is_countable_functionality(). 210 * 211 * @ticket 43583 212 * 213 * @return array { 214 * @type array { 215 * @type mixed $variable Variable to check. 216 * @type bool $is_countable The expected return value of PHP 7.3 is_countable() function. 217 * } 218 * } 219 */ 220 public function countable_variable_test_data() { 221 return array( 222 array( true, false ), 223 array( new stdClass(), false ), 224 array( new ArrayIteratorFake(), true ), 225 array( new CountableFake(), true ), 226 array( 16, false ), 227 array( null, false ), 228 array( array( 1, 2, 3 ), true ), 229 array( (array) 1, true ), 230 array( (object) array( 'foo', 'bar', 'baz' ), false ), 231 ); 232 } 189 233 } 190 234 … … 195 239 } 196 240 } 241 242 class ArrayIteratorFake extends ArrayIterator { 243 } 244 245 class CountableFake implements Countable { 246 public function count() { 247 return 16; 248 } 249 }
Note: See TracChangeset
for help on using the changeset viewer.