for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace IBM\Watson\Common\Tests;
use Mockery as m;
use IBM\Watson\Common\Helper;
class HelperTest extends \PHPUnit_Framework_TestCase
{
public function testCamelCase()
$result = Helper::camelCase('test_case');
$this->assertEquals('testCase', $result);
}
public function testCamelCaseIgnoresWhenAlreadyCorrect()
$result = Helper::camelCase('testCase');
public function testCamelCaseWithUppercaseValue()
$result = Helper::camelCase('TEST_CASE');
public function testInitializeIgnoresNullValues()
$target = m::mock();
Helper::initialize($target, null);
null
array
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);
public function testInitializeIgnoresString()
Helper::initialize($target, 'invalid');
'invalid'
string
public function testInitializeCallsSetters()
$target = m::mock('\IBM\Watson\Common\AbstractService');
$target->shouldReceive('setUsername')->once()->with('adam');
$target->shouldReceive('setPassword')->once()->with('01234');
Helper::initialize($target, ['username' => 'adam', 'password' => '01234']);
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: