1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
<?php
namespace GuzzleHttp\Tests;
use GuzzleHttp\Utils;
class UtilsTest extends \PHPUnit_Framework_TestCase
{
public function testExpandsTemplate()
{
$this->assertEquals(
'foo/123',
Utils::uriTemplate('foo/{bar}', ['bar' => '123'])
);
}
public function noBodyProvider()
{
return [['get'], ['head'], ['delete']];
}
public function testJsonDecodes()
{
$this->assertTrue(Utils::jsonDecode('true'));
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON
*/
public function testJsonDecodesWithErrorMessages()
{
Utils::jsonDecode('!narf!');
}
}
|