for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Bundle\ClientBundle\Tests\Manager;
use Xabbuh\XApi\Bundle\ClientBundle\Manager\ClientManager;
/**
* @author Christian Flothmann <[email protected]>
class ClientManagerTest extends \PHPUnit_Framework_TestCase
{
public function testGetClient()
$client = $this->createClientMock();
$manager = $this->createManager(array('foo' => $client));
$this->assertSame($client, $manager->getClient('foo'));
}
* @expectedException \InvalidArgumentException
public function testGetClientWithoutRegisteredClients()
$manager->getClient('bar');
public function testGetClientWithNonExistingClient()
$manager = $this->createManager(array());
private function createManager(array $clients)
return new ClientManager($clients);
private function createClientMock()
return $this->getMockBuilder('\Xabbuh\XApi\Client\XApiClient')
->disableOriginalConstructor()
->getMock();