Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Tests: add unit test workflow #72

Merged
merged 35 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
01092d7
chore: add workflow demo file
glaubersilva Oct 20, 2022
aec3ded
feature: checkout give repository
glaubersilva Oct 20, 2022
ac87b5f
feature: ls give folder
glaubersilva Oct 20, 2022
92b808d
fix: remove quotes
glaubersilva Oct 20, 2022
999f41b
fix: working-directory
glaubersilva Oct 20, 2022
a35661e
fix: ls path
glaubersilva Oct 20, 2022
67a313a
fix: checkout
glaubersilva Oct 20, 2022
e23f888
fix: checkout side by side
glaubersilva Oct 20, 2022
863612d
fix: path
glaubersilva Oct 20, 2022
e965c65
feature: composer install for give core
glaubersilva Oct 20, 2022
af3e25b
feature: add tests workflow
glaubersilva Oct 20, 2022
b235220
fix: syntax
glaubersilva Oct 20, 2022
9bae436
feature: add include-tests-workflow branch for tests
glaubersilva Oct 20, 2022
665fdcb
fix: branch name for tests
glaubersilva Oct 20, 2022
9f67090
fix: addon slug
glaubersilva Oct 21, 2022
0219828
refactor: temporary change for workflow tests
glaubersilva Oct 21, 2022
2525b2c
refactor: temporary change for workflow tests
glaubersilva Oct 21, 2022
004679d
refactor: temporary change for workflow tests
glaubersilva Oct 21, 2022
2a0e26b
refactor: use one DB per branch
glaubersilva Oct 21, 2022
150022a
refactor: revert to the original test code content
glaubersilva Oct 21, 2022
87d2544
refactor: remove test branch from action events
glaubersilva Oct 21, 2022
a8bc8c4
refactor: remove demo action
glaubersilva Oct 21, 2022
7884e56
refactor: remove comma
glaubersilva Oct 21, 2022
4116d0e
Merge branch 'develop' into feature/include-tests-workflow
Oct 31, 2022
fc8dace
test: add test comment to trigger new action
Oct 31, 2022
f68c7e7
refactor: move the order of steps around and add setupnode which migh…
Nov 1, 2022
d7e59a1
fix: build step
Nov 1, 2022
d2ee896
Merge branch 'develop' into feature/include-tests-workflow
Nov 1, 2022
689075f
tests: fix failing test
Nov 1, 2022
da7283d
tests: fix failing test for php8 named arguments
Nov 1, 2022
ef46d76
chore: update tests
Nov 1, 2022
9a1c4f3
feature: add new unit-tests action that references givewp-github-acti…
Nov 1, 2022
2f7e120
tests: use addon_slug input
Nov 1, 2022
a79c767
fix: remove unused ref
Nov 1, 2022
cd8415b
refactor: remove local testing action in favor of givewp-github-actions
Nov 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Unit Tests

on:
push:
pull_request:
workflow_call: # Allows you to use this workflow as part of another workflow
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab

jobs:
build:
uses: impress-org/givewp-github-actions/.github/workflows/addon-tests.yml@master
with:
addon_slug: givewp-next-gen
5 changes: 3 additions & 2 deletions tests/Feature/Controllers/BlockRenderControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ public function testShouldReturnIframe()
$viewUrl = (new GenerateDonationFormViewRouteUrl())($formId, $formTemplateId);

$blockRenderController = new BlockRenderController();

$this->assertSame(
"<iframe data-givewp-embed src='$viewUrl'
style='width: 1px;min-width: 100%;border: 0;'></iframe>",
$blockRenderController->render(['formId' => $formId, 'formTemplateId' => $formTemplateId]));
$blockRenderController->render(['formId' => $formId, 'formTemplateId' => $formTemplateId])
);
}
}
12 changes: 5 additions & 7 deletions tests/Unit/DataTransferObjects/BlockAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ class BlockAttributesTest extends TestCase
public function attributesProvider(): array
{
return array(
['formId' => 1, 'formTemplateId' => 1],
['formId' => null, 'formTemplateId' => null],
['formId' => null, 'formTemplateId' => 1],
['formId' => 1, 'formTemplateId' => null],
['formId' => 1, null],
[null, 'formTemplateId' => 1],
[null, null],
['formId' => 1, 'formTemplateId' => 1],
['formId' => 1, 'formTemplateId' => null],
['formId' => null, 'formTemplateId' => 1],
['formId' => null, 'formTemplateId' => null],
[null, null],
);
}

Expand Down
1 change: 1 addition & 0 deletions tests/Unit/ViewModels/FormBuilderViewModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function testShouldReturnStorageData()
$viewModel->storageData($formId),
[
'resourceURL' => rest_url(FormBuilderRestRouteConfig::NAMESPACE . '/form/' . $formId),
'previewURL' => site_url("?givewp-view=donation-form&form-id=$formId&form-template-id=classic"),
'nonce' => wp_create_nonce('wp_rest'),
'blockData' => get_post($formId)->post_content,
'settings' => get_post_meta($formId, 'formBuilderSettings', true),
Expand Down