1<?php
2/**
3 * Copyright 2011-2017 Horde LLC (http://www.horde.org/)
4 *
5 * @category   Horde
6 * @package    Support
7 * @subpackage UnitTests
8 * @license    http://www.horde.org/licenses/bsd
9 */
10
11/**
12 * @category   Horde
13 * @package    Support
14 * @subpackage UnitTests
15 * @license    http://www.horde.org/licenses/bsd
16 */
17class Horde_Support_MemoryTest extends PHPUnit_Framework_TestCase
18{
19    public function testMemoryStart()
20    {
21        $t = new Horde_Support_Memory;
22        $this->assertInternalType('array', $t->push());
23    }
24
25    public function testMemoryEnd()
26    {
27        $t = new Horde_Support_Memory;
28        $t->push();
29        $this->assertInternalType('array', $t->pop());
30    }
31
32    public function testStartValues()
33    {
34        $t = new Horde_Support_Memory;
35        $this->assertEquals(4, count($t->push()));
36    }
37
38    public function testEndValues()
39    {
40        $t = new Horde_Support_Memory;
41        $t->push();
42        $this->assertEquals(4, count($t->pop()));
43    }
44
45    public function testOnlyIncrease()
46    {
47        $t = new Horde_Support_Memory;
48        $t->push();
49        $end = $t->pop();
50        $this->assertTrue($end[1] >= 0);
51        $this->assertTrue($end[3] >= 0);
52    }
53
54    public function testNotPushedThrowsException()
55    {
56        $t = new Horde_Support_Memory();
57        try {
58            $t->pop();
59            $this->fail('Expected Exception');
60        } catch (Exception $e) {}
61    }
62
63}
64