Ejemplo n.º 1
0
 public function testUnion()
 {
     // from js
     $result = __::union(array(1, 2, 3), array(2, 30, 1), array(1, 40));
     $this->assertEquals(array(1, 2, 3, 30, 40), $result, 'takes the union of a list of arrays');
     // extra
     $result = __(array(1, 2, 3))->union(array(2, 30, 1), array(1, 40));
     $this->assertEquals(array(1, 2, 3, 30, 40), $result, 'works with OO-style call');
     // docs
     $arr1 = array(1, 2, 3);
     $arr2 = array(101, 2, 1, 10);
     $arr3 = array(2, 1);
     $this->assertEquals(array(1, 2, 3, 101, 10), __::union($arr1, $arr2, $arr3));
 }
Ejemplo n.º 2
0
 public function testUnion()
 {
     $object = array(array(1, 2, 3, 4, 5), array(3, 4, 5, 6, 7), array(5, 6, 7, 8, 9, 10));
     $return = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
     $result = __::union($object[0], $object[1], $object[2]);
     $this->assertEquals($return, $result);
 }