Skip to content

Commit

Permalink
Fix up exception messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Jan 4, 2024
1 parent 04247fd commit 76445ad
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/Validation/AtValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 57 in src/Validation/AtValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/AtValidation.php#L57

Added line #L57 was not covered by tests
}

/**
Expand All @@ -66,6 +66,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 69 in src/Validation/AtValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/AtValidation.php#L69

Added line #L69 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion src/Validation/AuValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 71 in src/Validation/AuValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/AuValidation.php#L71

Added line #L71 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/BdValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 57 in src/Validation/BdValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/BdValidation.php#L57

Added line #L57 was not covered by tests
}

/**
Expand All @@ -66,6 +66,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 69 in src/Validation/BdValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/BdValidation.php#L69

Added line #L69 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/BeValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 57 in src/Validation/BeValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/BeValidation.php#L57

Added line #L57 was not covered by tests
}

/**
Expand All @@ -65,6 +65,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 68 in src/Validation/BeValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/BeValidation.php#L68

Added line #L68 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/CaValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 57 in src/Validation/CaValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/CaValidation.php#L57

Added line #L57 was not covered by tests
}

/**
Expand All @@ -65,6 +65,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 68 in src/Validation/CaValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/CaValidation.php#L68

Added line #L68 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/ChValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 58 in src/Validation/ChValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/ChValidation.php#L58

Added line #L58 was not covered by tests
}

/**
Expand All @@ -67,6 +67,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 70 in src/Validation/ChValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/ChValidation.php#L70

Added line #L70 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/CzValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 57 in src/Validation/CzValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/CzValidation.php#L57

Added line #L57 was not covered by tests
}

/**
Expand All @@ -66,6 +66,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 69 in src/Validation/CzValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/CzValidation.php#L69

Added line #L69 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion src/Validation/DeValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ public static function dob(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 105 in src/Validation/DeValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/DeValidation.php#L105

Added line #L105 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion src/Validation/FiValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 58 in src/Validation/FiValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/FiValidation.php#L58

Added line #L58 was not covered by tests
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Validation/GbValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 55 in src/Validation/GbValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/GbValidation.php#L55

Added line #L55 was not covered by tests
}

/**
Expand All @@ -64,6 +64,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 67 in src/Validation/GbValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/GbValidation.php#L67

Added line #L67 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/HrValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 56 in src/Validation/HrValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/HrValidation.php#L56

Added line #L56 was not covered by tests
}

/**
Expand All @@ -65,6 +65,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 68 in src/Validation/HrValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/HrValidation.php#L68

Added line #L68 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/IdValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function mobile(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 70 in src/Validation/IdValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/IdValidation.php#L70

Added line #L70 was not covered by tests
}

/**
Expand All @@ -79,6 +79,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 82 in src/Validation/IdValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/IdValidation.php#L82

Added line #L82 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion src/Validation/InValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 70 in src/Validation/InValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/InValidation.php#L70

Added line #L70 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion src/Validation/ItValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ public static function cf(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 109 in src/Validation/ItValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/ItValidation.php#L109

Added line #L109 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion src/Validation/JpValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ public static function zenkaku(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 161 in src/Validation/JpValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/JpValidation.php#L161

Added line #L161 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/LvValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class LvValidation extends LocalizedValidation
*/
public static function postal(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 45 in src/Validation/LvValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/LvValidation.php#L45

Added line #L45 was not covered by tests
}

/**
Expand All @@ -54,7 +54,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 57 in src/Validation/LvValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/LvValidation.php#L57

Added line #L57 was not covered by tests
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Validation/MxValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public static function postal(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 70 in src/Validation/MxValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/MxValidation.php#L70

Added line #L70 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/PtValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 57 in src/Validation/PtValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/PtValidation.php#L57

Added line #L57 was not covered by tests
}

/**
Expand All @@ -66,6 +66,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 69 in src/Validation/PtValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/PtValidation.php#L69

Added line #L69 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/RoValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 57 in src/Validation/RoValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/RoValidation.php#L57

Added line #L57 was not covered by tests
}

/**
Expand All @@ -66,6 +66,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 69 in src/Validation/RoValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/RoValidation.php#L69

Added line #L69 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion src/Validation/RsValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ public static function jmbg(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 131 in src/Validation/RsValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/RsValidation.php#L131

Added line #L131 was not covered by tests
}
}
4 changes: 2 additions & 2 deletions src/Validation/SkValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function postal(string $check): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 57 in src/Validation/SkValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/SkValidation.php#L57

Added line #L57 was not covered by tests
}

/**
Expand All @@ -66,6 +66,6 @@ public static function phone(string $check): bool
*/
public static function personId(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));

Check warning on line 69 in src/Validation/SkValidation.php

View check run for this annotation

Codecov / codecov/patch

src/Validation/SkValidation.php#L69

Added line #L69 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion src/Validation/TrValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static function personId(string $tckn): bool
*/
public static function phone(string $check): bool
{
throw new NotImplementedException(__d('localized', '%s Not implemented yet.'));
throw new NotImplementedException(__d('localized', '`{0}()` Not implemented yet.', __METHOD__));
}

/**
Expand Down
12 changes: 12 additions & 0 deletions tests/TestCase/Validation/TrValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
namespace Cake\Localized\Test\TestCase\Validation;

use Cake\Http\Exception\NotImplementedException;
use Cake\Localized\Validation\TrValidation;
use Cake\TestSuite\TestCase;

Expand Down Expand Up @@ -56,4 +57,15 @@ public function testPersonId()
$this->assertFalse(TrValidation::personId('01216166930'));
$this->assertFalse(TrValidation::personId('31216166931'));
}

/**
* @return void
*/
public function testPhone(): void
{
$this->expectException(NotImplementedException::class);
$this->expectExceptionMessage('`Cake\Localized\Validation\TrValidation::phone()` Not implemented yet.');

TrValidation::phone('');
}
}

0 comments on commit 76445ad

Please sign in to comment.