[MediaWiki-commits] [Gerrit] Added DeleteFailedException - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/64934 Change subject: Added DeleteFailedException .. Added DeleteFailedException Change-Id: Ib70c85b202c1db9c8735baa94f9eb373c4b022f3 --- A Database/includes/DeleteFailedException.php A Database/tests/phpunit/DeleteFailedExceptionTest.php 2 files changed, 117 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/34/64934/1 diff --git a/Database/includes/DeleteFailedException.php b/Database/includes/DeleteFailedException.php new file mode 100644 index 000..e940cc0 --- /dev/null +++ b/Database/includes/DeleteFailedException.php @@ -0,0 +1,55 @@ +?php + +namespace Wikibase\Database; + +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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 DeleteFailedException extends QueryInterfaceException { + + protected $tableName; + protected $conditions; + + public function __construct( $tableName, array $conditions, $message = '', \Exception $previous = null ) { + parent::__construct( $message, 0, $previous ); + + $this-tableName = $tableName; + $this-conditions = $conditions; + } + + /** +* @return string +*/ + public function getTableName() { + return $this-tableName; + } + + /** +* @return array +*/ + public function getConditions() { + return $this-conditions; + } + +} diff --git a/Database/tests/phpunit/DeleteFailedExceptionTest.php b/Database/tests/phpunit/DeleteFailedExceptionTest.php new file mode 100644 index 000..4ffc7c6 --- /dev/null +++ b/Database/tests/phpunit/DeleteFailedExceptionTest.php @@ -0,0 +1,62 @@ +?php + +namespace Wikibase\Database\Tests; + +use Wikibase\Database\DeleteFailedException; + +/** + * @covers Wikibase\Database\DeleteFailedException + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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 DeleteFailedExceptionTest extends \PHPUnit_Framework_TestCase { + + public function testConstructorWithOnlyRequiredArguments() { + $tableName = 'nyancats'; + $conditions = array( 'foo' = 42, 'awesome 9000' ); + + $exception = new DeleteFailedException( $tableName, $conditions ); + + $this-assertEquals( $tableName, $exception-getTableName() ); + $this-assertEquals( $conditions, $exception-getConditions() ); + } + + public function testConstructorWithAllArguments() { + $tableName = 'users'; + $conditions = array( 'foo' = 42 ); + $message = 'NyanData all the way accross the sky!'; + $previous = new \Exception( 'Onoez!' ); + + $exception = new DeleteFailedException( $tableName, $conditions, $message, $previous ); + + $this-assertEquals( $tableName, $exception-getTableName() ); + $this-assertEquals( $conditions, $exception-getConditions() ); + $this-assertEquals( $message, $exception-getMessage() ); + $this-assertEquals(
[MediaWiki-commits] [Gerrit] Added DeleteFailedException - change (mediawiki...Wikibase)
Denny Vrandecic has submitted this change and it was merged. Change subject: Added DeleteFailedException .. Added DeleteFailedException Change-Id: Ib70c85b202c1db9c8735baa94f9eb373c4b022f3 --- A Database/includes/DeleteFailedException.php A Database/tests/phpunit/DeleteFailedExceptionTest.php 2 files changed, 117 insertions(+), 0 deletions(-) Approvals: Denny Vrandecic: Looks good to me, approved jenkins-bot: Verified diff --git a/Database/includes/DeleteFailedException.php b/Database/includes/DeleteFailedException.php new file mode 100644 index 000..e940cc0 --- /dev/null +++ b/Database/includes/DeleteFailedException.php @@ -0,0 +1,55 @@ +?php + +namespace Wikibase\Database; + +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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 DeleteFailedException extends QueryInterfaceException { + + protected $tableName; + protected $conditions; + + public function __construct( $tableName, array $conditions, $message = '', \Exception $previous = null ) { + parent::__construct( $message, 0, $previous ); + + $this-tableName = $tableName; + $this-conditions = $conditions; + } + + /** +* @return string +*/ + public function getTableName() { + return $this-tableName; + } + + /** +* @return array +*/ + public function getConditions() { + return $this-conditions; + } + +} diff --git a/Database/tests/phpunit/DeleteFailedExceptionTest.php b/Database/tests/phpunit/DeleteFailedExceptionTest.php new file mode 100644 index 000..4ffc7c6 --- /dev/null +++ b/Database/tests/phpunit/DeleteFailedExceptionTest.php @@ -0,0 +1,62 @@ +?php + +namespace Wikibase\Database\Tests; + +use Wikibase\Database\DeleteFailedException; + +/** + * @covers Wikibase\Database\DeleteFailedException + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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 DeleteFailedExceptionTest extends \PHPUnit_Framework_TestCase { + + public function testConstructorWithOnlyRequiredArguments() { + $tableName = 'nyancats'; + $conditions = array( 'foo' = 42, 'awesome 9000' ); + + $exception = new DeleteFailedException( $tableName, $conditions ); + + $this-assertEquals( $tableName, $exception-getTableName() ); + $this-assertEquals( $conditions, $exception-getConditions() ); + } + + public function testConstructorWithAllArguments() { + $tableName = 'users'; + $conditions = array( 'foo' = 42 ); + $message = 'NyanData all the way accross the sky!'; + $previous = new \Exception( 'Onoez!' ); + + $exception = new DeleteFailedException( $tableName, $conditions, $message, $previous ); + + $this-assertEquals( $tableName, $exception-getTableName() ); + $this-assertEquals( $conditions, $exception-getConditions() ); + $this-assertEquals( $message, $exception-getMessage() ); + $this-assertEquals( $previous, $exception-getPrevious() ); + } + +}