File: RemoveFromArrayTest.php

package info (click to toggle)
postfixadmin 4.0.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,888 kB
  • sloc: php: 12,256; perl: 1,156; sh: 717; python: 142; xml: 63; sql: 3; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 708 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

class RemoveFromArrayTest extends \PHPUnit\Framework\TestCase
{
    public function testBasic()
    {
        $list = array('a','b','c','d');

        list($found, $new) = remove_from_array($list, 'd');
        $this->assertEquals(1, $found);
        $this->assertEquals(array('a','b','c'), $new);

        list($found, $new) = remove_from_array($list, 'a');
        $this->assertEquals(1, $found);
        $this->assertEquals(array(1 => 'b',2 => 'c',3 => 'd'), $new);

        list($found, $new) = remove_from_array($list, 'x');
        $this->assertEquals(0, $found);
        $this->assertEquals(array('a','b','c','d'), $new);
    }
}

/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */