[MediaWiki-commits] [Gerrit] Added InsertFailedException - change (mediawiki...Wikibase)
Denny Vrandecic has submitted this change and it was merged. Change subject: Added InsertFailedException .. Added InsertFailedException Change-Id: I12a18822c4f4ee2e8ea3cf950edba33fa53e59dc --- M Database/includes/DeleteFailedException.php A Database/includes/InsertFailedException.php A Database/tests/phpunit/InsertFailedExceptionTest.php 3 files changed, 119 insertions(+), 2 deletions(-) Approvals: Denny Vrandecic: Looks good to me, approved jenkins-bot: Verified diff --git a/Database/includes/DeleteFailedException.php b/Database/includes/DeleteFailedException.php index e940cc0..41b135b 100644 --- a/Database/includes/DeleteFailedException.php +++ b/Database/includes/DeleteFailedException.php @@ -31,11 +31,11 @@ protected $tableName; protected $conditions; - public function __construct( $tableName, array $conditions, $message = '', \Exception $previous = null ) { + public function __construct( $tableName, array $values, $message = '', \Exception $previous = null ) { parent::__construct( $message, 0, $previous ); $this->tableName = $tableName; - $this->conditions = $conditions; + $this->conditions = $values; } /** diff --git a/Database/includes/InsertFailedException.php b/Database/includes/InsertFailedException.php new file mode 100644 index 000..aa7cb19 --- /dev/null +++ b/Database/includes/InsertFailedException.php @@ -0,0 +1,55 @@ +http://www.gnu.org/copyleft/gpl.html + * + * @since 0.1 + * + * @file + * @ingroup WikibaseDatabase + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class InsertFailedException extends QueryInterfaceException { + + protected $tableName; + protected $values; + + public function __construct( $tableName, array $values, $message = '', \Exception $previous = null ) { + parent::__construct( $message, 0, $previous ); + + $this->tableName = $tableName; + $this->values = $values; + } + + /** +* @return string +*/ + public function getTableName() { + return $this->tableName; + } + + /** +* @return array +*/ + public function getValues() { + return $this->values; + } + +} diff --git a/Database/tests/phpunit/InsertFailedExceptionTest.php b/Database/tests/phpunit/InsertFailedExceptionTest.php new file mode 100644 index 000..d3dc897 --- /dev/null +++ b/Database/tests/phpunit/InsertFailedExceptionTest.php @@ -0,0 +1,62 @@ +http://www.gnu.org/copyleft/gpl.html + * + * @file + * @since 0.1 + * + * @ingroup WikibaseDatabaseTest + * + * @group Wikibase + * @group WikibaseDatabase + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class InsertFailedExceptionTest extends \PHPUnit_Framework_TestCase { + + public function testConstructorWithOnlyRequiredArguments() { + $tableName = 'nyancats'; + $values = array( 'foo' => 42, 'awesome > 9000' ); + + $exception = new InsertFailedException( $tableName, $values ); + + $this->assertEquals( $tableName, $exception->getTableName() ); + $this->assertEquals( $values, $exception->getValues() ); + } + + public function testConstructorWithAllArguments() { + $tableName = 'users'; + $values = array( 'foo' => 42 ); + $message = 'NyanData all the way accross the sky!'; + $previous = new \Exception( 'Onoez!' ); + + $exception = new InsertFailedException( $tableName, $values, $message, $previous ); + + $this->assertEquals( $tableName, $exception->getTableName() ); + $this->assertEquals( $values, $exception->getValues() ); + $this->assertEquals( $message, $exception->getMessage() ); + $this->assertEquals( $previous, $exception->getPrevious() ); + } + +} -- To view, visit https://gerrit.wikimedia.org/r/64939 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I12a18822c4f4ee2e8ea3cf950edba33fa53e59dc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw Gerrit-Reviewer: Denny Vrandecic Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added InsertFailedException - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/64939 Change subject: Added InsertFailedException .. Added InsertFailedException Change-Id: I12a18822c4f4ee2e8ea3cf950edba33fa53e59dc --- M Database/includes/DeleteFailedException.php A Database/includes/InsertFailedException.php A Database/tests/phpunit/InsertFailedExceptionTest.php 3 files changed, 119 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/39/64939/1 diff --git a/Database/includes/DeleteFailedException.php b/Database/includes/DeleteFailedException.php index e940cc0..41b135b 100644 --- a/Database/includes/DeleteFailedException.php +++ b/Database/includes/DeleteFailedException.php @@ -31,11 +31,11 @@ protected $tableName; protected $conditions; - public function __construct( $tableName, array $conditions, $message = '', \Exception $previous = null ) { + public function __construct( $tableName, array $values, $message = '', \Exception $previous = null ) { parent::__construct( $message, 0, $previous ); $this->tableName = $tableName; - $this->conditions = $conditions; + $this->conditions = $values; } /** diff --git a/Database/includes/InsertFailedException.php b/Database/includes/InsertFailedException.php new file mode 100644 index 000..aa7cb19 --- /dev/null +++ b/Database/includes/InsertFailedException.php @@ -0,0 +1,55 @@ +http://www.gnu.org/copyleft/gpl.html + * + * @since 0.1 + * + * @file + * @ingroup WikibaseDatabase + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class InsertFailedException extends QueryInterfaceException { + + protected $tableName; + protected $values; + + public function __construct( $tableName, array $values, $message = '', \Exception $previous = null ) { + parent::__construct( $message, 0, $previous ); + + $this->tableName = $tableName; + $this->values = $values; + } + + /** +* @return string +*/ + public function getTableName() { + return $this->tableName; + } + + /** +* @return array +*/ + public function getValues() { + return $this->values; + } + +} diff --git a/Database/tests/phpunit/InsertFailedExceptionTest.php b/Database/tests/phpunit/InsertFailedExceptionTest.php new file mode 100644 index 000..d3dc897 --- /dev/null +++ b/Database/tests/phpunit/InsertFailedExceptionTest.php @@ -0,0 +1,62 @@ +http://www.gnu.org/copyleft/gpl.html + * + * @file + * @since 0.1 + * + * @ingroup WikibaseDatabaseTest + * + * @group Wikibase + * @group WikibaseDatabase + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class InsertFailedExceptionTest extends \PHPUnit_Framework_TestCase { + + public function testConstructorWithOnlyRequiredArguments() { + $tableName = 'nyancats'; + $values = array( 'foo' => 42, 'awesome > 9000' ); + + $exception = new InsertFailedException( $tableName, $values ); + + $this->assertEquals( $tableName, $exception->getTableName() ); + $this->assertEquals( $values, $exception->getValues() ); + } + + public function testConstructorWithAllArguments() { + $tableName = 'users'; + $values = array( 'foo' => 42 ); + $message = 'NyanData all the way accross the sky!'; + $previous = new \Exception( 'Onoez!' ); + + $exception = new InsertFailedException( $tableName, $values, $message, $previous ); + + $this->assertEquals( $tableName, $exception->getTableName() ); + $this->assertEquals( $values, $exception->getValues() ); + $this->assertEquals( $message, $exception->getMessage() ); + $this->assertEquals( $previous, $exception->getPrevious() ); + } + +} -- To view, visit https://gerrit.wikimedia.org/r/64939 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I12a18822c4f4ee2e8ea3cf950edba33fa53e59dc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits