-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract interface of
ValidationResult
This allows to use mocks in tests. The constructor of `ValidationResult` is only useful when a real validation was performed.
- Loading branch information
Dominic Tubach
committed
Jul 5, 2024
1 parent
55b26f9
commit cc5bb8e
Showing
4 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
Civi/RemoteTools/JsonSchema/Validation/ValidationResultInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/* | ||
* Copyright (C) 2024 SYSTOPIA GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation in version 3. | ||
* | ||
* 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 Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Civi\RemoteTools\JsonSchema\Validation; | ||
|
||
use Systopia\JsonSchema\Tags\TaggedDataContainerInterface; | ||
|
||
interface ValidationResultInterface { | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
public function getData(): array; | ||
|
||
public function getTaggedData(): TaggedDataContainerInterface; | ||
|
||
/** | ||
* @return array<string, non-empty-list<string>> | ||
*/ | ||
public function getErrorMessages(): array; | ||
|
||
/** | ||
* @return array<string, non-empty-list<string>> | ||
*/ | ||
public function getLeafErrorMessages(): array; | ||
|
||
public function hasErrors(): bool; | ||
|
||
public function isValid(): bool; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters