/** * @test */ public function findAddressByCep() { $handler = new MockHandler([new Response(200, [], json_encode(['bairro' => 'Cidade Salvador', 'cidade' => 'Jacareí', 'estado_info' => ['nome' => 'São Paulo'], 'logradouro' => 'Rua Mabito Shoji', 'complemento' => null]))]); $client = new Client(['handler' => HandlerStack::create($handler)]); $postmon = new Postmon($client); $address = $postmon->findAddressByCep(Cep::fromString('12312300')); $this->assertInstanceOf(PartialAddress::class, $address); }
/** * @test */ public function forCep() { $this->assertInstanceOf(CepNotFoundException::class, CepNotFoundException::forCep(Cep::fromString('12312300'))); }
/** * @test */ public function fromString() { $cep = Cep::fromString('12312300'); $this->assertInstanceOf(Cep::class, $cep); $this->assertEquals('12312300', (string) $cep); }