| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 20 | public function testFinalizarPedido() |
||
| 21 | { |
||
| 22 | $this->pagSeguroController->setToken('25AB84E7DE7647848D0819210140F79D'); |
||
| 23 | |||
| 24 | $this->pagSeguroController->setEmail('[email protected]'); |
||
| 25 | |||
| 26 | $produto = array( |
||
| 27 | 0 => array( |
||
| 28 | 'Produto' => array( |
||
| 29 | 'id' => 23, |
||
| 30 | 'nome' => 'Produto Teste', |
||
| 31 | 'variacao' => 'M', |
||
| 32 | 'quantidade' => 1.00, |
||
| 33 | 'preco' => 2.44 |
||
| 34 | ) |
||
| 35 | ) |
||
| 36 | ); |
||
| 37 | |||
| 38 | $this->pagSeguroController->setProdutos($produto); |
||
| 39 | |||
| 40 | $this->pagSeguroController->adicionarProdutosGateway(); |
||
| 41 | |||
| 42 | $endereco = array( |
||
| 43 | 'cep' => '07252-000', |
||
| 44 | 'endereco' => 'Avenida do Contorno', |
||
| 45 | 'numero' => 19, |
||
| 46 | 'complemento' => 'Viela', |
||
| 47 | 'bairro' => 'Nova cidade', |
||
| 48 | 'cidade' => 'Guarulhos', |
||
| 49 | 'estado' => 'SP' |
||
| 50 | ); |
||
| 51 | |||
| 52 | $this->pagSeguroController->setEndereco($endereco); |
||
| 53 | |||
| 54 | $cliente = array( |
||
| 55 | 'nome' => 'Reginaldo Junior', |
||
| 56 | 'email' => '[email protected]', |
||
| 57 | 'ddd' => '11', |
||
| 58 | 'telefone' => '946640932', |
||
| 59 | 'cpf' => '43944409843' |
||
| 60 | ); |
||
| 61 | |||
| 62 | $this->pagSeguroController->setCliente($cliente); |
||
| 63 | |||
| 64 | $this->pagSeguroController->setReference('#2324'); |
||
| 65 | |||
| 66 | $this->pagSeguroController->setValorFrete(23.44); |
||
| 67 | |||
| 68 | $url = $this->pagSeguroController->finalizarPedido(); |
||
| 69 | |||
| 70 | $this->assertContains('http', $url); |
||
| 71 | } |
||
| 72 | |||
| 74 |