Skip to content

Commit b84ee93

Browse files
committed
New BadMethodCallException exception. Tests for BadMethodCallException too.
1 parent 3e0839f commit b84ee93

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

lib/Github/Client.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Github\Api\ApiInterface;
66
use Github\Exception\InvalidArgumentException;
7+
use Github\Exception\BadMethodCallException;
78
use Github\HttpClient\HttpClient;
89
use Github\HttpClient\HttpClientInterface;
910

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Github\Exception;
4+
5+
/**
6+
* BadMethodCallException
7+
*
8+
* @author James Brooks <jbrooksuk@me.com>
9+
*/
10+
class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
11+
{
12+
13+
}

test/Github/Tests/ClientTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Github\Client;
66
use Github\Exception\InvalidArgumentException;
7+
use Github\Exception\BadMethodCallException;
78

89
class ClientTest extends \PHPUnit_Framework_TestCase
910
{
@@ -145,6 +146,16 @@ public function shouldNotGetApiInstance()
145146
$client->api('do_not_exist');
146147
}
147148

149+
/**
150+
* @test
151+
* @expectedException BadMethodCallException
152+
*/
153+
public function shouldNotGetMagicApiInstance()
154+
{
155+
$client = new Client();
156+
$client->doNotExist();
157+
}
158+
148159
public function getApiClassesProvider()
149160
{
150161
return array(

0 commit comments

Comments
 (0)