Skip to content

Commit ac511c8

Browse files
committed
Add tests
1 parent 1f61dfe commit ac511c8

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
'break' in with() jumps out of the block, considered a success
3+
--FILE--
4+
<?php
5+
6+
require 'basic_manager.inc';
7+
8+
with (new Manager() as $value) {
9+
echo "In with() block\n";
10+
break;
11+
echo "Not executed\n";
12+
var_dump($value);
13+
}
14+
15+
echo "After with() block\n";
16+
17+
?>
18+
--EXPECT--
19+
Manager::enterContext()
20+
In with() block
21+
Manager::exitContext(null)
22+
After with() block
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
'continue' in with() jumps out of the block, considered a success, warns like 'switch'
3+
--FILE--
4+
<?php
5+
6+
require 'basic_manager.inc';
7+
8+
with (new Manager() as $value) {
9+
echo "In with() block\n";
10+
continue;
11+
echo "Not executed\n";
12+
var_dump($value);
13+
}
14+
15+
echo "After with() block\n";
16+
17+
?>
18+
--EXPECTF--
19+
Warning: "continue" targeting with is equivalent to "break" in %s on line %d
20+
Manager::enterContext()
21+
In with() block
22+
Manager::exitContext(null)
23+
After with() block

0 commit comments

Comments
 (0)