Exemple #1
0
 public function testStartChain()
 {
     // Function constructor
     $this->assertEquals(42, arr([42])->pop());
     // Static constructors
     $this->assertEquals(42, Arrgh::arr([42])->pop());
     $this->assertEquals(42, Arrgh::chain([42])->pop());
     // Object constructor
     $this->assertEquals(42, (new Arrgh([42]))->pop());
     // Create from Arggh object
     $this->assertEquals(42, arr(arr([42]))->pop());
     // Static chain method prefix
     $this->assertEquals(42, Arrgh::_filter([42])->pop());
     $this->assertEquals(42, Arrgh::_range(0, 42)->pop());
 }
Exemple #2
0
 public function testMultisortChained()
 {
     $input1 = [100, 1, 10, 1000];
     $input2 = [1, 3, 2, 4];
     $this->assertEquals(3, Arrgh::chain($input1)->multisort($input2)->pop()->shift());
 }