toArray() public method

public toArray ( )
コード例 #1
0
 public function testConcat()
 {
     $this->coll->add(1)->add(2)->add(4);
     $coll2 = new ArrayList([3]);
     $this->coll->concat($coll2);
     $this->assertEquals([1, 2, 4, 3], $this->coll->toArray());
     $coll3 = new Dictionary(['key1' => 'value1', 'key2' => 'wrongValue']);
     $coll4 = new Dictionary(['key2' => 'value2']);
     $coll3->concat($coll4);
     $this->assertEquals(['key1' => 'value1', 'key2' => 'value2'], $coll3->toArray());
 }
コード例 #2
0
 public function testToArray()
 {
     $data = ['key1' => 'value1', 'key2' => 'value2', 'key3' => ['key3.1' => 'value3.1']];
     $this->coll->addAll($data);
     $this->assertEquals($data, $this->coll->toArray());
 }