for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class correiosTest extends PHPUnit_Framework_TestCase {
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
/**
* Testa o construtor da classe
*/
public function testConstructClass()
{
$this->assertInstanceOf('correios', new correios);
}
public function testGetContent()
$correios = new correios();
$this->assertContains('submitcarrinho_correios', $correios->getContent());
public function testGetOrderShippingCostSEDEXHoje()
$this->testGetOrderShppingCost("4", 10, 33);
public function testGetOrderShippingCostSEDEX10()
$this->testGetOrderShppingCost("3", 10, 27.799999999999997);
public function testGetOrderShippingCostSEDEX()
$this->testGetOrderShppingCost("2", 10, 17.199999999999999);
public function testGetOrderShppingCost($id_carrier = "1", $shipping_cost = 10, $expected_value = 16.1)
$correios->id_carrier = $id_carrier;
$params = new Params();
$frete = $correios->getOrderShippingCost($params, $shipping_cost);
$params
object<Params>
object<type>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$shipping_cost
integer
$this->assertEquals($shipping_cost + $expected_value, $frete);
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.