Skip to content

Commit

Permalink
Fix preview language.code test
Browse files Browse the repository at this point in the history
  • Loading branch information
esamattis committed Oct 1, 2020
1 parent c697858 commit 3af0d56
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/wpunit/PostPreviewQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public function testCanHaveLanguageField()
'post_status' => 'inherit',
'post_parent' => $post_id,
]);
pll_set_post_language($preview_id, 'en');
// Note: The language of the preview post is not set at all in a real
// wp instance so we won't be setting it here neighter. wpgql-polylang
// must read the language from the original.

$query = "
query Preview {
Expand All @@ -55,7 +57,7 @@ public function testCanHaveLanguageField()
wp_set_current_user(1);
$result = do_graphql_request($query);
$this->assertArrayNotHasKey('errors', $result, print_r($result, true));
$this->assertEquals($result['data']['post']['language']['code'], 'EN');
$this->assertEquals($result['data']['post']['language']['code'], 'FI');
}

public function testCanFetchTranslatedVersions()
Expand Down

0 comments on commit 3af0d56

Please sign in to comment.