for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
include '../vendor/autoload.php';
use Guzzle\Http;
class MetadataTest extends PHPUnit_Framework_TestCase
{
protected $bundle = null;
protected $media = 'http://media.clarify.io/audio/samples/harvard-sentences-1.wav';
public function setUp()
global $apikey;
$this->client = new \Clarify\Client($apikey);
client
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->bundle = new \Clarify\Bundle($apikey, $this->client);
$this->metadata = new \Clarify\Metadata($this->client);
metadata
parent::setUp();
}
/**
* @expectedException \Clarify\Exceptions\InvalidJSONException
*/
public function testUpdateWithJSONException()
$params = array('data' => 'not a json string');
$this->metadata->update($params);
public function testUpdate()
$name = 'name - testMetadataUpdate';
$this->bundle->create($name, $this->media);
$this->assertEquals(201, $this->bundle->getStatusCode());
$location = $this->bundle->location;
$params = array('data' => '{"name" : "value"}', 'id' => $location);
$result = $this->bundle->metadata->update($params);
$this->assertTrue($result);
$this->assertTrue($this->bundle->delete($location));
$this->assertEquals(204, $this->bundle->getStatusCode());
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: