function it_can_track_with_one_object(Client $client, RastreamentoResult $result) { $response = new FakeRastreamentoResponse('object'); $data = ['Usuario' => '', 'Senha' => '', 'Tipo' => 'L', 'Resultado' => 'U', 'Objetos' => '']; $client->post(Data::URL_RASTREAMENTO, ['body' => $data])->willReturn($response); # result $result->fill(Argument::any())->shouldBeCalled(); $this->track()->shouldBeAnInstanceOf('EscapeWork\\Frete\\Correios\\RastreamentoResult'); }
protected function makeCollection($data) { $objects = new Collection(); foreach ($data->objeto as $objeto) { $result = new RastreamentoResult(); $result->fill($objeto); $objects[] = $result; } return $objects; }