Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/65695
Change subject: Added ThrowingPatcherTest to test throwErrors and ignoreErrors ...................................................................... Added ThrowingPatcherTest to test throwErrors and ignoreErrors Change-Id: Ic4c5d90a0cc3b38dc68088051f3812e8b0d22c55 --- A tests/phpunit/patcher/ThrowingPatcherTest.php 1 file changed, 60 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Diff refs/changes/95/65695/1 diff --git a/tests/phpunit/patcher/ThrowingPatcherTest.php b/tests/phpunit/patcher/ThrowingPatcherTest.php new file mode 100644 index 0000000..0ec613c --- /dev/null +++ b/tests/phpunit/patcher/ThrowingPatcherTest.php @@ -0,0 +1,60 @@ +<?php + +namespace Diff\Tests; + +use ReflectionClass; + +/** + * @covers Diff\ThrowingPatcher + * + * 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.7 + * + * @ingroup DiffTest + * + * @group Diff + * @group DiffPatcher + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class ThrowingPatcherTest extends DiffTestCase { + + public function testChangeThrowErrors() { + $patcher = $this->getMockForAbstractClass( 'Diff\ThrowingPatcher' ); + + $class = new ReflectionClass( 'Diff\ThrowingPatcher' ); + $method = $class->getMethod( 'handleError' ); + $method->setAccessible( true ); + + $errorMessage = 'foo bar'; + + $method->invokeArgs( $patcher, array( $errorMessage ) ); + + $patcher->throwErrors(); + $patcher->ignoreErrors(); + + $method->invokeArgs( $patcher, array( $errorMessage ) ); + + $patcher->throwErrors(); + $this->setExpectedException( 'Diff\PatcherException' ); + + $method->invokeArgs( $patcher, array( $errorMessage ) ); + } + +} -- To view, visit https://gerrit.wikimedia.org/r/65695 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic4c5d90a0cc3b38dc68088051f3812e8b0d22c55 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Diff Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits