Skip to content

Commit 842c722

Browse files
committed
Fix tests, add tests
1 parent 0684bc6 commit 842c722

File tree

6 files changed

+40
-4
lines changed

6 files changed

+40
-4
lines changed

tests/001.phpt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ memprof_disable();
1313

1414
var_dump(memprof_enabled());
1515

16-
--EXPECT--
16+
--EXPECTF--
1717
bool(false)
18+
19+
Warning: Calling memprof_enable() manually may not work as expected because of PHP optimizations. Prefer using MEMPROF_PROFILE=1 as environment variable, GET, or POST in %s
1820
bool(true)
19-
bool(false)
2021

22+
Warning: Memprof profiling was enabled, but no profile was dumped. Did you forget to call one of memprof_dump_callgrind(), memprof_dump_pprof(), or memprof_dump_array() ? %s
23+
bool(false)

tests/002.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ $b = Eater::eat();
2222

2323
var_dump(memprof_dump_array());
2424

25-
--EXPECT--
25+
--EXPECTF--
2626
string(9) "Exception"
27+
28+
Warning: Calling memprof_enable() manually may not work as expected because of PHP optimizations. Prefer using MEMPROF_PROFILE=1 as environment variable, GET, or POST in %s
2729
array(6) {
2830
["memory_size"]=>
2931
int(0)

tests/003.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ $b = Eater::eat();
1212

1313
memprof_dump_callgrind(STDOUT);
1414

15-
--EXPECT--
15+
--EXPECTF--
16+
Warning: Calling memprof_enable() manually may not work as expected because of PHP optimizations. Prefer using MEMPROF_PROFILE=1 as environment variable, GET, or POST in %s
1617
version: 1
1718
cmd: unknown
1819
positions: line

tests/004.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Enable with environment variable
3+
--ENV--
4+
MEMPROF_PROFILE=1
5+
--FILE--
6+
<?php
7+
var_dump(memprof_enabled());
8+
memprof_dump_array();
9+
--EXPECT--
10+
bool(true)

tests/005.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Enable with query string parameter
3+
--GET--
4+
MEMPROF_PROFILE=1
5+
--FILE--
6+
<?php
7+
var_dump(memprof_enabled());
8+
memprof_dump_array();
9+
--EXPECT--
10+
bool(true)

tests/006.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Enable with post field
3+
--POST--
4+
MEMPROF_PROFILE=1
5+
--FILE--
6+
<?php
7+
var_dump(memprof_enabled());
8+
memprof_dump_array();
9+
--EXPECT--
10+
bool(true)

0 commit comments

Comments
 (0)