From 0fd8a303852e2d01277a557adda9773814866141 Mon Sep 17 00:00:00 2001 From: Airton Zanon Date: Fri, 17 Feb 2023 11:02:59 +0100 Subject: [PATCH] Integration Test To be sure that a new version of contentful client or any other variables that might interfeer in the execution of this command doesn't break it, we're adding an integration test that will hit the real contentful API. Signed-off-by: Airton Zanon --- .github/workflows/tests.yml | 3 ++ phpunit.xml.dist | 7 ++--- .../SculpinContentfulCommandTest.php | 28 +++++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 tests/Integration/SculpinContentfulCommandTest.php diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4d82781..2d7c371 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,6 +6,9 @@ jobs: build: name: CI runs-on: ubuntu-latest + env: + contentful_space_id: ${{ secrets.CONTENTFUL_SPACE_ID }} + contentful_token: ${{ secrets.CONTENTFUL_TOKEN }} strategy: matrix: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 808b9c8..eaa7f98 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,14 +9,13 @@ verbose="true" colors="true" > - - - - ./tests/Unit + + ./tests/Integration + diff --git a/tests/Integration/SculpinContentfulCommandTest.php b/tests/Integration/SculpinContentfulCommandTest.php new file mode 100644 index 0000000..df443f9 --- /dev/null +++ b/tests/Integration/SculpinContentfulCommandTest.php @@ -0,0 +1,28 @@ +setContentfulClient($client); + $commandTester = new CommandTester($command); + $commandTester->execute([]); + + $output = $commandTester->getDisplay(); + self::assertStringContainsString("Created file", $output); + } +}