xref: /PHP-7.2/ext/spl/tests/heap_010.phpt (revision 0eea0a05)
1--TEST--
2SPL: SplHeap with overriden count()
3--FILE--
4<?php
5$obj = new SplMaxHeap();
6$obj->insert(1);
7$obj->insert(2);
8var_dump(count($obj));
9class SplMaxHeap2 extends SplMaxHeap{
10    public function count() {
11        return -parent::count();
12    }
13}
14$obj = new SplMaxHeap2();
15$obj->insert(1);
16$obj->insert(2);
17var_dump(count($obj));
18?>
19--EXPECT--
20int(2)
21int(-2)
22