-
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.
This moves our content tests to Drone and adds a new test to make sure the message files are valid json. Ticket: https://phabricator.wikimedia.org/T254880
- Loading branch information
Showing
3 changed files
with
70 additions
and
16 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
This file was deleted.
Oops, something went wrong.
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,62 @@ | ||
<?php | ||
|
||
declare( strict_types=1 ); | ||
|
||
namespace WMDE\Fundraising\Content\Tests\Validation; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class JsonIsValidTest extends TestCase { | ||
|
||
/** | ||
* @dataProvider jsonFileDataProvider | ||
*/ | ||
public function testJsonFilesAreValid( string $file ): void { | ||
json_decode( $file ); | ||
$this->assertTrue( json_last_error() === JSON_ERROR_NONE ); | ||
} | ||
|
||
private function jsonFileDataProvider(): \Generator { | ||
yield [ $this->loadFile( 'de_DE/data/contact_categories.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/data/countries.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/data/faq.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/data/pages.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/data/salutations.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/data/supporters.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/data/use_of_funds_content.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/data/validation.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/daysOfTheWeek.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/mail.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/membershipTypes.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/messages.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/pageTitles.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/paymentIntervals.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/paymentProvider.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/paymentStatus.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/paymentTypes.json' ) ]; | ||
yield [ $this->loadFile( 'de_DE/messages/siteMetadata.json' ) ]; | ||
|
||
yield [ $this->loadFile( 'en_GB/data/contact_categories.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/data/countries.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/data/faq.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/data/pages.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/data/salutations.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/data/supporters.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/data/use_of_funds_content.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/data/validation.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/daysOfTheWeek.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/mail.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/membershipTypes.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/messages.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/pageTitles.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/paymentIntervals.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/paymentProvider.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/paymentStatus.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/paymentTypes.json' ) ]; | ||
yield [ $this->loadFile( 'en_GB/messages/siteMetadata.json' ) ]; | ||
} | ||
|
||
private function loadFile( string $path ): string { | ||
return file_get_contents( __DIR__ . '/../../i18n/' . $path ); | ||
} | ||
} |