Thiemo Mättig (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351870 )

Change subject: Reduce PHPCS limtLimit further to 184
......................................................................

Reduce PHPCS limtLimit further to 184

Change-Id: Ie5c9036d6e54bb57a5a8c81550e46bac7f7bd890
---
M includes/ConstraintCheck/DelegatingConstraintChecker.php
M phpcs.xml
M tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php
M tests/phpunit/Checker/FormatChecker/FormatCheckerTest.php
M tests/phpunit/Checker/OneOfChecker/OneOfCheckerTest.php
5 files changed, 303 insertions(+), 48 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
 refs/changes/70/351870/1

diff --git a/includes/ConstraintCheck/DelegatingConstraintChecker.php 
b/includes/ConstraintCheck/DelegatingConstraintChecker.php
index 73b8abe..55220fd 100644
--- a/includes/ConstraintCheck/DelegatingConstraintChecker.php
+++ b/includes/ConstraintCheck/DelegatingConstraintChecker.php
@@ -194,13 +194,25 @@
         * @return CheckResult[]
         */
        private function checkConstraintsForStatementOnEntity( array 
$constraints, EntityDocument $entity, $statement ) {
-               $result = array ();
+               $entityId = $entity->getId();
+               $result = [];
 
                foreach ( $constraints as $constraint ) {
-                       $parameter = $constraint->getConstraintParameters();
-                       if ( array_key_exists( 'known_exception', $parameter) 
&& in_array( $entity->getId()->getSerialization(), explode( ',', 
$parameter['known_exception'] ) ) ) {
-                               $message = 'This entity is a known exception 
for this constraint and has been marked as such.';
-                               $result[] = new CheckResult( $entity->getId(), 
$statement, $constraint->getConstraintTypeQid(), 
$constraint->getConstraintId(), array (), CheckResult::STATUS_EXCEPTION, 
$message ); // todo: display parameters anyway
+                       $parameters = $constraint->getConstraintParameters();
+
+                       if ( array_key_exists( 'known_exception', $parameters )
+                               && in_array( $entityId->getSerialization(), 
explode( ',', $parameters['known_exception'] ) )
+                       ) {
+                               $result[] = new CheckResult(
+                                       $entityId,
+                                       $statement,
+                                       $constraint->getConstraintTypeQid(),
+                                       $constraint->getConstraintId(),
+                                       // TODO: Display parameters anyway.
+                                       [],
+                                       CheckResult::STATUS_EXCEPTION,
+                                       'This entity is a known exception for 
this constraint and has been marked as such.'
+                               );
                                continue;
                        }
 
diff --git a/phpcs.xml b/phpcs.xml
index 2d9c4ab..332cd5e 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -13,8 +13,8 @@
        <rule ref="Generic.Files.LineLength">
                <properties>
                        <!-- FIXME: Should be lowered to at least 140. -->
-                       <property name="lineLimit" value="219" />
-                       <property name="absoluteLineLimit" value="219" />
+                       <property name="lineLimit" value="184" />
+                       <property name="absoluteLineLimit" value="184" />
                </properties>
        </rule>
 
diff --git 
a/tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php 
b/tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php
index 5908030..12f6455 100644
--- a/tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php
+++ b/tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php
@@ -77,7 +77,13 @@
        public function testCommonsLinkConstraintValid() {
                $value = new StringValue( 'test image.jpg' );
                $statement = new Statement( new PropertyValueSnak( new 
PropertyId( 'P1' ), $value ) );
-               $this->assertEquals( 'compliance', 
$this->commonsLinkChecker->checkConstraint( $statement, 
$this->getConstraintMock( array( 'namespace' => 'File' ) ), $this->getEntity() 
)->getStatus(), 'check should comply' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'namespace' => 'File' ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'compliance', $result->getStatus(), 'check 
should comply' );
        }
 
        public function testCommonsLinkConstraintInvalid() {
@@ -87,36 +93,102 @@
                $statement1 = new Statement( new PropertyValueSnak( new 
PropertyId( 'P1' ), $value1 ) );
                $statement2 = new Statement( new PropertyValueSnak( new 
PropertyId( 'P1' ), $value2 ) );
                $statement3 = new Statement( new PropertyValueSnak( new 
PropertyId( 'P1' ), $value3 ) );
-               $this->assertEquals( 'violation', 
$this->commonsLinkChecker->checkConstraint( $statement1, 
$this->getConstraintMock( array( 'namespace' => 'File' ) ), $this->getEntity() 
)->getStatus(), 'check should not comply' );
-               $this->assertEquals( 'violation', 
$this->commonsLinkChecker->checkConstraint( $statement2, 
$this->getConstraintMock( array( 'namespace' => 'File' ) ), $this->getEntity() 
)->getStatus(), 'check should not comply' );
-               $this->assertEquals( 'violation', 
$this->commonsLinkChecker->checkConstraint( $statement3, 
$this->getConstraintMock( array( 'namespace' => 'File' ) ), $this->getEntity() 
)->getStatus(), 'check should not comply' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement1,
+                       $this->getConstraintMock( [ 'namespace' => 'File' ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement2,
+                       $this->getConstraintMock( [ 'namespace' => 'File' ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement3,
+                       $this->getConstraintMock( [ 'namespace' => 'File' ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testNotImplementedNamespaces() {
                $value = new StringValue( 'test image.jpg' );
                $statement = new Statement( new PropertyValueSnak( new 
PropertyId( 'P1' ), $value ) );
-               $this->assertEquals( 'todo', 
$this->commonsLinkChecker->checkConstraint( $statement, 
$this->getConstraintMock( array() ), $this->getEntity() )->getStatus(), 'check 
is not implemented' );
-               $this->assertEquals( 'todo', 
$this->commonsLinkChecker->checkConstraint( $statement, 
$this->getConstraintMock( array( 'namespace' => 'Gallery') ), 
$this->getEntity() )->getStatus(), 'check is not implemented' );
-               $this->assertEquals( 'todo', 
$this->commonsLinkChecker->checkConstraint( $statement, 
$this->getConstraintMock( array( 'namespace' => 'Institution') ), 
$this->getEntity() )->getStatus(), 'check is not implemented' );
-               $this->assertEquals( 'todo', 
$this->commonsLinkChecker->checkConstraint( $statement, 
$this->getConstraintMock( array( 'namespace' => 'Museum') ), $this->getEntity() 
)->getStatus(), 'check is not implemented' );
-               $this->assertEquals( 'todo', 
$this->commonsLinkChecker->checkConstraint( $statement, 
$this->getConstraintMock( array( 'namespace' => 'Creator') ), 
$this->getEntity() )->getStatus(), 'check is not implemented' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check is 
not implemented' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'namespace' => 'Gallery' ] 
),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check is 
not implemented' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'namespace' => 
'Institution' ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check is 
not implemented' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'namespace' => 'Museum' ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check is 
not implemented' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'namespace' => 'Creator' ] 
),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check is 
not implemented' );
        }
 
        public function testCommonsLinkConstraintNotExistent() {
                $value = new StringValue( 'no image.jpg' );
                $statement = new Statement( new PropertyValueSnak( new 
PropertyId( 'P1' ), $value ) );
-               $this->assertEquals( 'violation', 
$this->commonsLinkChecker->checkConstraint( $statement, 
$this->getConstraintMock( array( 'namespace' => 'File' ) ), $this->getEntity() 
)->getStatus(), 'check should not comply' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'namespace' => 'File' ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testCommonsLinkConstraintNoStringValue() {
                $value = new EntityIdValue( new ItemId( 'Q1' ) );
                $statement = new Statement( new PropertyValueSnak( new 
PropertyId( 'P1' ), $value ) );
-               $this->assertEquals( 'violation', 
$this->commonsLinkChecker->checkConstraint( $statement, 
$this->getConstraintMock( array( 'namespace' => 'File' ) ), $this->getEntity() 
)->getStatus(), 'check should not comply' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'namespace' => 'File' ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testCommonsLinkConstraintNoValueSnak() {
                $statement = new Statement( new PropertyNoValueSnak( 1 ) );
-               $this->assertEquals( 'violation', 
$this->commonsLinkChecker->checkConstraint( $statement, 
$this->getConstraintMock( array( 'namespace' => 'File' ) ), $this->getEntity() 
)->getStatus(), 'check should not comply' );
+
+               $result = $this->commonsLinkChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'namespace' => 'File' ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        /**
diff --git a/tests/phpunit/Checker/FormatChecker/FormatCheckerTest.php 
b/tests/phpunit/Checker/FormatChecker/FormatCheckerTest.php
index a63fef8..656f9f3 100644
--- a/tests/phpunit/Checker/FormatChecker/FormatCheckerTest.php
+++ b/tests/phpunit/Checker/FormatChecker/FormatCheckerTest.php
@@ -75,16 +75,75 @@
                $statement9 = new Statement( new PropertyValueSnak( new 
PropertyId( 'P345' ), $value9 ) );
                $statement10 = new Statement( new PropertyValueSnak( new 
PropertyId( 'P345' ), $value10 ) );
 
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement1, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement2, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement3, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement4, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement5, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement6, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement7, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement8, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement9, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement10, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
+               $result = $this->formatChecker->checkConstraint(
+                       $statement1,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement2,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement3,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement4,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement5,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement6,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement7,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement8,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement9,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement10,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testFormatConstraintTaxonName() {
@@ -119,23 +178,88 @@
                $statement9 = new Statement( new PropertyValueSnak( new 
PropertyId( 'P345' ), $value9 ) );
                $statement10 = new Statement( new PropertyValueSnak( new 
PropertyId( 'P345' ), $value10 ) );
 
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement1, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement2, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement3, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement4, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement5, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement6, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement7, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement8, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement9, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement10, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
+               $result = $this->formatChecker->checkConstraint(
+                       $statement1,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement2,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement3,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement4,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement5,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement6,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement7,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement8,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement9,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement10,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testFormatConstraintEmptyPattern() {
                $pattern = null;
                $value = new StringValue( 'Populus × canescens' );
                $statement = new Statement( new PropertyValueSnak( new 
PropertyId( 'P345' ), $value ) );
-               $this->assertEquals( 'todo', 
$this->formatChecker->checkConstraint( $statement, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'todo', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testFormatConstraintNoStringValue() {
@@ -150,13 +274,25 @@
 
                $value = new EntityIdValue( new ItemId( 'Q1' ) );
                $statement = new Statement( new PropertyValueSnak( new 
PropertyId( 'P345' ), $value ) );
-               $this->assertEquals( 'violation', 
$this->formatChecker->checkConstraint( $statement, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testFormatConstraintNoValueSnak() {
                $pattern = ".";
                $statement = new Statement( new PropertyNoValueSnak( 1 ) );
-               $this->assertEquals( 'violation', 
$this->formatChecker->checkConstraint( $statement, $this->getConstraintMock( 
array( 'pattern' => $pattern ) ), $this->getEntity() )->getStatus(), 'check 
should not comply' );
+
+               $result = $this->formatChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'pattern' => $pattern ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        /**
diff --git a/tests/phpunit/Checker/OneOfChecker/OneOfCheckerTest.php 
b/tests/phpunit/Checker/OneOfChecker/OneOfCheckerTest.php
index 71353b9..376207a 100644
--- a/tests/phpunit/Checker/OneOfChecker/OneOfCheckerTest.php
+++ b/tests/phpunit/Checker/OneOfChecker/OneOfCheckerTest.php
@@ -58,34 +58,69 @@
 
                $values = 'Q1,Q2,Q3';
 
-               $this->assertEquals( 'compliance', 
$this->oneOfChecker->checkConstraint( $statementIn, $this->getConstraintMock( 
array( 'item' => $values ) ), $this->getEntity() )->getStatus(), 'check should 
comply' );
-               $this->assertEquals( 'violation', 
$this->oneOfChecker->checkConstraint( $statementNotIn, 
$this->getConstraintMock( array( 'item' => $values ) ), $this->getEntity() 
)->getStatus(), 'check should not comply' );
+               $result = $this->oneOfChecker->checkConstraint(
+                       $statementIn,
+                       $this->getConstraintMock( [ 'item' => $values ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'compliance', $result->getStatus(), 'check 
should comply' );
+
+               $result = $this->oneOfChecker->checkConstraint(
+                       $statementNotIn,
+                       $this->getConstraintMock( [ 'item' => $values ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testOneOfConstraintWrongType() {
                $value = new StringValue( 'Q1' );
                $statement = new Statement( new PropertyValueSnak( new 
PropertyId( 'P123' ), $value ) );
                $values = 'Q1,Q2,Q3';
-               $this->assertEquals( 'violation', 
$this->oneOfChecker->checkConstraint( $statement, $this->getConstraintMock( 
array( 'item' => $values ) ), $this->getEntity() )->getStatus(), 'check should 
not comply' );
+
+               $result = $this->oneOfChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'item' => $values ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testOneOfConstraintEmptyArray() {
                $value = new EntityIdValue( new ItemId( 'Q1' ) );
                $statement = new Statement( new PropertyValueSnak( new 
PropertyId( 'P123' ), $value ) );
-               $this->assertEquals( 'violation', 
$this->oneOfChecker->checkConstraint( $statement, $this->getConstraintMock( 
array() ), $this->getEntity() )->getStatus(), 'check should not comply' );
+
+               $result = $this->oneOfChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        public function testOneOfConstraintArrayWithSomevalue() {
                $value = new EntityIdValue( new ItemId( 'Q1' ) );
                $statement = new Statement( new PropertyValueSnak( new 
PropertyId( 'P123' ), $value ) );
                $values = 'Q1,Q2,Q3,somevalue';
-               $this->assertEquals( 'compliance', 
$this->oneOfChecker->checkConstraint( $statement, $this->getConstraintMock( 
array( 'item' => $values ) ), $this->getEntity() )->getStatus(), 'check should 
comply' );
+
+               $result = $this->oneOfChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'item' => $values ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'compliance', $result->getStatus(), 'check 
should comply' );
        }
 
        public function testOneOfConstraintNoValueSnak() {
                $statement = new Statement( new PropertyNoValueSnak( 1 ) );
                $values = 'Q1,Q2,Q3,somevalue';
-               $this->assertEquals( 'violation', 
$this->oneOfChecker->checkConstraint( $statement, $this->getConstraintMock( 
array( 'item' => $values ) ), $this->getEntity() )->getStatus(), 'check should 
not comply' );
+
+               $result = $this->oneOfChecker->checkConstraint(
+                       $statement,
+                       $this->getConstraintMock( [ 'item' => $values ] ),
+                       $this->getEntity()
+               );
+               $this->assertEquals( 'violation', $result->getStatus(), 'check 
should not comply' );
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/351870
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5c9036d6e54bb57a5a8c81550e46bac7f7bd890
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to