php-src/tests/classes/array_access_013.phpt
Fabien Villepinte a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00

57 lines
1019 B
PHP

--TEST--
ZE2 ArrayAccess and exceptions
--FILE--
<?php
class Test implements ArrayAccess
{
public function offsetExists($offset) { throw new Exception(__METHOD__); return false; }
public function offsetGet($offset) { throw new Exception(__METHOD__); return $offset; }
public function offsetSet($offset, $data ) { throw new Exception(__METHOD__); }
public function offsetUnset($offset) { throw new Exception(__METHOD__); }
}
$t = new Test;
try
{
echo isset($t[0]);
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
}
try
{
echo $t[0];
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
}
try
{
$t[0] = 1;
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
}
try
{
unset($t[0]);
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
}
?>
--EXPECT--
Caught in Test::offsetExists()
Caught in Test::offsetGet()
Caught in Test::offsetSet()
Caught in Test::offsetUnset()