1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Wikibase\Database\Tests\QueryInterface; |
4
|
|
|
|
5
|
|
|
use Wikibase\Database\Exception\SelectFailedException; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @covers Wikibase\Database\Exception\SelectFailedException |
9
|
|
|
* |
10
|
|
|
* @group Wikibase |
11
|
|
|
* @group WikibaseDatabase |
12
|
|
|
* |
13
|
|
|
* @licence GNU GPL v2+ |
14
|
|
|
* @author Jeroen De Dauw < [email protected] > |
15
|
|
|
*/ |
16
|
|
|
class SelectFailedExceptionTest extends \PHPUnit_Framework_TestCase { |
17
|
|
|
|
18
|
|
|
public function testConstructorWithOnlyRequiredArguments() { |
19
|
|
|
$tableName = 'nyancats'; |
20
|
|
|
$fields = array( 'bar', 'baz', 'bah' ); |
21
|
|
|
$conditions = array( 'foo' => 42, 'awesome > 9000' ); |
22
|
|
|
|
23
|
|
|
$exception = new SelectFailedException( $tableName, $fields, $conditions ); |
24
|
|
|
|
25
|
|
|
$this->assertEquals( $tableName, $exception->getTableName() ); |
26
|
|
|
$this->assertEquals( $fields, $exception->getFields() ); |
27
|
|
|
$this->assertEquals( $conditions, $exception->getConditions() ); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function testConstructorWithAllArguments() { |
31
|
|
|
$tableName = 'users'; |
32
|
|
|
$fields = array( 'bar' ); |
33
|
|
|
$conditions = array( 'foo' => 42 ); |
34
|
|
|
$message = 'NyanData all the way accross the sky!'; |
35
|
|
|
$previous = new \Exception( 'Onoez!' ); |
36
|
|
|
|
37
|
|
|
$exception = new SelectFailedException( $tableName, $fields, $conditions, $message, $previous ); |
38
|
|
|
|
39
|
|
|
$this->assertEquals( $tableName, $exception->getTableName() ); |
40
|
|
|
$this->assertEquals( $fields, $exception->getFields() ); |
41
|
|
|
$this->assertEquals( $conditions, $exception->getConditions() ); |
42
|
|
|
$this->assertEquals( $message, $exception->getMessage() ); |
43
|
|
|
$this->assertEquals( $previous, $exception->getPrevious() ); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
} |
47
|
|
|
|