コード例 #1
0
 public function test_treeByDepth()
 {
     /** === Test Data === */
     $asCustId = 'id';
     $asDepth = 'depth';
     $shoulrReverse = true;
     $depth0 = 0;
     $depth1 = 1;
     $data = [[$asCustId => 1, $asDepth => $depth0], [$asCustId => 2, $asDepth => $depth0], [$asCustId => 3, $asDepth => $depth1]];
     /** === Setup Mocks === */
     /** === Call and asserts  === */
     $req = new Request\TreeByDepth();
     $req->setDataToMap($data);
     $req->setAsCustomerId($asCustId);
     $req->setAsDepth($asDepth);
     $req->setShouldReversed($shoulrReverse);
     $resp = $this->obj->treeByDepth($req);
     $this->assertTrue($resp->isSucceed());
     $mapped = $resp->getMapped();
     $this->assertTrue(is_array($mapped));
     $this->assertEquals(2, count($mapped[$depth0]));
     $this->assertEquals(1, count($mapped[$depth1]));
 }