Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-326: New content elements #506

Merged
merged 76 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
c50344d
OP-326: Single media content type + configuration
jkindly Jul 5, 2024
2af6c8e
OP-326: Multiple media content type
jkindly Jul 5, 2024
4b077fa
OP-326: Heading content type
jkindly Jul 5, 2024
3d4673d
OP-326: Textarea content type constant
jkindly Jul 5, 2024
6b6581e
OP-326: Products Carousel content type
jkindly Jul 5, 2024
dd06d73
OP-326: Products Carousel By Taxon content type
jkindly Jul 5, 2024
5f2c35e
OP-326: Taxons list element type
jkindly Jul 8, 2024
b794f8b
OP-326: PHPStan anc ECS fixes
jkindly Jul 8, 2024
5b9850d
OP-326: Translations
jkindly Jul 8, 2024
f74e4e1
OP-326: Behat single media
jkindly Jul 8, 2024
3079770
OP-326: Behat single media
jkindly Jul 8, 2024
54f11e0
OP-326: ECS fixes
jkindly Jul 8, 2024
6e7fac4
OP-326: setup media
jkindly Jul 8, 2024
eb610d5
OP-326: js fix for blocks
jkindly Jul 8, 2024
476deb9
OP-326: Behat for heading content element
jkindly Jul 9, 2024
818c30c
OP-326: Behat for products carousel content element
jkindly Jul 9, 2024
f98a9af
OP-326: Behat for products carousel by taxon content element
jkindly Jul 9, 2024
ab9dc5a
OP-326: Missing suites
jkindly Jul 9, 2024
6622c3c
OP-326: Behat for taxons list content element
jkindly Jul 9, 2024
e0ce8eb
OP-326: Missing PHPDoc
jkindly Jul 9, 2024
9dfa8d0
OP-326: Behat - make sure content element exists after create page/block
jkindly Jul 9, 2024
c7fcf23
OP-326: Behat - error fixes
jkindly Jul 9, 2024
fac6dfe
OP-326: Behat - move behaviour trait to update section instead create
jkindly Jul 9, 2024
e3c457a
OP-326: Behat - testing result of hasElement method
jkindly Jul 9, 2024
1dfd7a6
OP-326: Behat - testing result of hasElement method
jkindly Jul 9, 2024
b70602e
OP-326: Behat - ContainsContentElementTrait.php adjustment
jkindly Jul 10, 2024
fca3d72
OP-326: Behat - ContainsContentElementTrait.php adjustment
jkindly Jul 10, 2024
726c73d
OP-326: Behat - ContainsContentElementTrait.php adjustment
jkindly Jul 10, 2024
1192bb8
OP-326: Behat - adding page with multiple content elements
jkindly Jul 10, 2024
bc81d10
OP-326: Behat - adding block/page with two content elements
jkindly Jul 10, 2024
391330d
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
394cb62
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
00a9086
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
d5f795c
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
f14c55a
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
bfee78a
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
17d7d69
OP-326: Single media content type + configuration
jkindly Jul 5, 2024
2903042
OP-326: Multiple media content type
jkindly Jul 5, 2024
dd75082
OP-326: Heading content type
jkindly Jul 5, 2024
bec6f03
OP-326: Textarea content type constant
jkindly Jul 5, 2024
f865b43
OP-326: Products Carousel content type
jkindly Jul 5, 2024
85f4eec
OP-326: Products Carousel By Taxon content type
jkindly Jul 5, 2024
10ac791
OP-326: Taxons list element type
jkindly Jul 8, 2024
591c5f6
OP-326: PHPStan anc ECS fixes
jkindly Jul 8, 2024
062dfd5
OP-326: Translations
jkindly Jul 8, 2024
5f96119
OP-326: Behat single media
jkindly Jul 8, 2024
514ff01
OP-326: Behat single media
jkindly Jul 8, 2024
4471eee
OP-326: ECS fixes
jkindly Jul 8, 2024
3c1f767
OP-326: setup media
jkindly Jul 8, 2024
612dbb8
OP-326: js fix for blocks
jkindly Jul 8, 2024
17dea40
OP-326: Behat for heading content element
jkindly Jul 9, 2024
da25be7
OP-326: Behat for products carousel content element
jkindly Jul 9, 2024
826da14
OP-326: Behat for products carousel by taxon content element
jkindly Jul 9, 2024
6265889
OP-326: Missing suites
jkindly Jul 9, 2024
681fc81
OP-326: Behat for taxons list content element
jkindly Jul 9, 2024
eb4d99a
OP-326: Missing PHPDoc
jkindly Jul 9, 2024
50cf4f2
OP-326: Behat - make sure content element exists after create page/block
jkindly Jul 9, 2024
4215d89
OP-326: Behat - error fixes
jkindly Jul 9, 2024
55d617b
OP-326: Behat - move behaviour trait to update section instead create
jkindly Jul 9, 2024
4704ad7
OP-326: Behat - testing result of hasElement method
jkindly Jul 9, 2024
dea0701
OP-326: Behat - testing result of hasElement method
jkindly Jul 9, 2024
e0adc36
OP-326: Behat - ContainsContentElementTrait.php adjustment
jkindly Jul 10, 2024
04e0fb6
OP-326: Behat - ContainsContentElementTrait.php adjustment
jkindly Jul 10, 2024
3aa380c
OP-326: Behat - ContainsContentElementTrait.php adjustment
jkindly Jul 10, 2024
ebb825c
OP-326: Behat - adding page with multiple content elements
jkindly Jul 10, 2024
daf905a
OP-326: Behat - adding block/page with two content elements
jkindly Jul 10, 2024
d4de6d7
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
d41ec83
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
0c3cb7f
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
07bd9e7
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
c463364
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
6dadc98
OP-326: Behat - deleting content element
jkindly Jul 10, 2024
0fd2d10
Merge remote-tracking branch 'origin/feature/OP-326' into feature/OP-326
jkindly Jul 11, 2024
e9185e7
OP-327: Code review changes
jkindly Jul 12, 2024
6c841bd
OP-327: Spec & repo tests
jkindly Jul 12, 2024
95e53a9
Merge branch 'feature/OP-312-redesign-cms-plugin' into feature/OP-326
jkindly Jul 12, 2024
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
100 changes: 99 additions & 1 deletion features/admin/adding_block.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,111 @@ Feature: Adding blocks
Then I should be notified that the block has been created

@ui @javascript
Scenario: Adding block with content element
Scenario: Adding block with textarea content element
When I go to the create block page
And I fill the code with "intro"
And I fill the name with "Intro"
And I click on Add button in Content elements section
And I select "Textarea" content element
And I add a textarea content element with "Welcome to our store" content
And I add it
Then I should be notified that the block has been created
And I should see newly created "Textarea" content element in Content elements section

@ui @javascript
Scenario: Adding block with single media content element
Given there is an existing media with "image_1" code and name "Image 1"
When I go to the create block page
And I fill the code with "intro"
And I fill the name with "Intro"
And I click on Add button in Content elements section
And I select "Single media" content element
And I add a single media content element with name "Image 1"
And I add it
Then I should be notified that the block has been created
And I should see newly created "Single media" content element in Content elements section

@ui @javascript
Scenario: Adding block with multiple media content element
Given there is an existing media with names "Image 1" and "Image 2"
When I go to the create block page
And I fill the code with "intro"
And I fill the name with "Intro"
And I click on Add button in Content elements section
And I select "Multiple media" content element
And I add a multiple media content element with names "Image 1" and "Image 2"
And I add it
Then I should be notified that the block has been created
And I should see newly created "Single media" content element in Content elements section

@ui @javascript
Scenario: Adding block with heading content element
When I go to the create block page
And I fill the code with "intro"
And I fill the name with "Intro"
And I click on Add button in Content elements section
And I select "Heading" content element
And I add a heading content element with type "H3" and "Welcome to our store" content
And I add it
Then I should be notified that the block has been created
And I should see newly created "Heading" content element in Content elements section

@ui @javascript
Scenario: Adding block with products carousel content element
Given the store has "iPhone 8" and "iPhone X" products
When I go to the create block page
And I fill the code with "intro"
And I fill the name with "Intro"
And I click on Add button in Content elements section
And I select "Products carousel" content element
And I add a products carousel content element with "iPhone 8" and "iPhone X" products
And I add it
Then I should be notified that the block has been created
And I should see newly created "Products carousel" content element in Content elements section

@ui @javascript
Scenario: Adding block with products carousel by taxon content element
Given the store has "Smartphones" taxonomy
When I go to the create block page
And I fill the code with "intro"
And I fill the name with "Intro"
And I click on Add button in Content elements section
And I select "Products carousel by Taxon" content element
And I add a products carousel by taxon content element with "Smartphones" taxonomy
And I add it
Then I should be notified that the block has been created
And I should see newly created "Products carousel by Taxon" content element in Content elements section

@ui @javascript
Scenario: Adding block with taxons list content element
Given the store classifies its products as "Smartphones" and "Laptops"
When I go to the create block page
And I fill the code with "intro"
And I fill the name with "Intro"
And I click on Add button in Content elements section
And I select "Taxons list" content element
And I add a taxons list content element with "Smartphones" and "Laptops" taxonomy
And I add it
Then I should be notified that the block has been created
And I should see newly created "Taxons list" content element in Content elements section

@ui @javascript
Scenario: Adding block with two content elements
Given there is an existing media with names "Image 1" and "Image 2"
And the store classifies its products as "Smartphones" and "Laptops"
When I go to the create block page
And I fill the code with "intro"
And I fill the name with "Intro"
And I click on Add button in Content elements section
And I select "Taxons list" content element
And I add a taxons list content element with "Smartphones" and "Laptops" taxonomy
And I click on Add button in Content elements section
And I select "Multiple media" content element
And I add a multiple media content element with names "Image 1" and "Image 2"
And I add it
Then I should be notified that the block has been created
And I should see newly created "Taxons list" content element in Content elements section
And I should see newly created "Multiple media" content element in Content elements section

@ui
Scenario: Trying to add block with existing code
Expand Down
106 changes: 105 additions & 1 deletion features/admin/adding_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,115 @@ Feature: Adding new page
Then I should be notified that the page has been created

@ui @javascript
Scenario: Adding page with content element
Scenario: Adding page with textarea content element
When I go to the create page page
And I fill the code with "my_page"
And I fill the slug with "my_page"
And I fill the name with "My page"
And I click on Add button in Content elements section
And I select "Textarea" content element
And I add a textarea content element with "Welcome to our store" content
And I add it
Then I should be notified that the page has been created
And I should see newly created "Textarea" content element in Content elements section

@ui @javascript
Scenario: Adding page with single media content element
Given there is an existing media with "image_1" code and name "Image 1"
When I go to the create page page
And I fill the code with "my_page"
And I fill the slug with "my_page"
And I fill the name with "My page"
And I click on Add button in Content elements section
And I select "Single media" content element
And I add a single media content element with name "Image 1"
And I add it
Then I should be notified that the page has been created
And I should see newly created "Single media" content element in Content elements section

@ui @javascript
Scenario: Adding page with multiple media content element
Given there is an existing media with names "Image 1" and "Image 2"
When I go to the create page page
And I fill the code with "my_page"
And I fill the slug with "my_page"
And I fill the name with "My page"
And I click on Add button in Content elements section
And I select "Multiple media" content element
And I add a multiple media content element with names "Image 1" and "Image 2"
And I add it
Then I should be notified that the page has been created
And I should see newly created "Multiple media" content element in Content elements section

@ui @javascript
Scenario: Adding page with heading content element
When I go to the create page page
And I fill the code with "my_page"
And I fill the slug with "my_page"
And I fill the name with "My page"
And I click on Add button in Content elements section
And I select "Heading" content element
And I add a heading content element with type "H3" and "Welcome to our store" content
And I add it
Then I should be notified that the page has been created
And I should see newly created "Heading" content element in Content elements section

@ui @javascript
Scenario: Adding page with products carousel content element
Given the store has "iPhone 8" and "iPhone X" products
When I go to the create page page
And I fill the code with "my_page"
And I fill the slug with "my_page"
And I fill the name with "My page"
And I click on Add button in Content elements section
And I select "Products carousel" content element
And I add a products carousel content element with "iPhone 8" and "iPhone X" products
And I add it
Then I should be notified that the page has been created
And I should see newly created "Products carousel" content element in Content elements section

@ui @javascript
Scenario: Adding page with products carousel by taxon content element
Given the store has "Smartphones" taxonomy
When I go to the create page page
And I fill the code with "my_page"
And I fill the slug with "my_page"
And I fill the name with "My page"
And I click on Add button in Content elements section
And I select "Products carousel by Taxon" content element
And I add a products carousel by taxon content element with "Smartphones" taxonomy
And I add it
Then I should be notified that the page has been created
And I should see newly created "Products carousel by Taxon" content element in Content elements section

@ui @javascript
Scenario: Adding page with taxons list content element
Given the store classifies its products as "Smartphones" and "Laptops"
When I go to the create page page
And I fill the code with "my_page"
And I fill the slug with "my_page"
And I fill the name with "My page"
And I click on Add button in Content elements section
And I select "Taxons list" content element
And I add a taxons list content element with "Smartphones" and "Laptops" taxonomy
And I add it
Then I should be notified that the page has been created
And I should see newly created "Taxons list" content element in Content elements section

@ui @javascript
Scenario: Adding page with two content elements
Given there is an existing media with names "Image 1" and "Image 2"
When I go to the create page page
And I fill the code with "my_page"
And I fill the slug with "my_page"
And I fill the name with "My page"
And I click on Add button in Content elements section
And I select "Single media" content element
And I add a single media content element with name "Image 1"
And I click on Add button in Content elements section
And I select "Multiple media" content element
And I add a multiple media content element with names "Image 1" and "Image 2"
And I add it
Then I should be notified that the page has been created
And I should see newly created "Single media" content element in Content elements section
And I should see newly created "Multiple media" content element in Content elements section
12 changes: 11 additions & 1 deletion features/admin/managing_blocks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,24 @@ Feature: Managing cms blocks

@ui
Scenario: Updating block textarea content element
Given there is a block with "store_phone_number" code and textarea content element
Given there is a block with "store_phone_number" code and "Textarea" content element
When I go to the update "store_phone_number" block page
And I fill the name with "Store phone number" if the name field is empty
And I change textarea content element value to "New content"
And I update it
Then I should be notified that the block has been successfully updated
And I should see "New content" in the textarea content element

@ui @javascript
Scenario: Deleting content element in block
Given there is a block with "store_phone_number" code and "Textarea" content element
When I go to the update "store_phone_number" block page
And I fill the name with "Store phone number" if the name field is empty
And I delete the content element
And I update it
Then I should be notified that the block has been successfully updated
And I should not see "Textarea" content element in the Content elements section

@ui
Scenario: Disabling block
Given there is an existing block with "bitbag_quote" code
Expand Down
11 changes: 10 additions & 1 deletion features/admin/managing_pages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,19 @@ Feature: Managing cms pages

@ui
Scenario: Updating page with textarea content element
Given there is a page in the store with textarea content element
Given there is a page in the store with "Textarea" content element
When I want to edit this page
And I fill "Code, Name" fields
And I change textarea content element value to "New content"
And I update it
Then I should be notified that the page was updated
And I should see "New content" in the textarea content element

@ui @javascript
Scenario: Deleting content element in page
Given there is a page in the store with "Textarea" content element
When I want to edit this page
And I delete the content element
And I update it
Then I should be notified that the page was updated
And I should not see "Textarea" content element in the Content elements section
76 changes: 76 additions & 0 deletions spec/Form/DataTransformer/MultipleMediaToCodesTransformerSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/

declare(strict_types=1);

namespace spec\BitBag\SyliusCmsPlugin\Form\DataTransformer;

use BitBag\SyliusCmsPlugin\Entity\MediaInterface;
use BitBag\SyliusCmsPlugin\Form\DataTransformer\MultipleMediaToCodesTransformer;
use BitBag\SyliusCmsPlugin\Repository\MediaRepositoryInterface;
use Doctrine\Common\Collections\ArrayCollection;
use PhpSpec\ObjectBehavior;

final class MultipleMediaToCodesTransformerSpec extends ObjectBehavior
{
public function let(MediaRepositoryInterface $mediaRepository): void
{
$this->beConstructedWith($mediaRepository);
}

public function it_is_initializable(): void
{
$this->shouldHaveType(MultipleMediaToCodesTransformer::class);
}

public function it_transforms_null_value_to_empty_collection(): void
{
$this->transform(null)->shouldBeAnInstanceOf(ArrayCollection::class);
$this->transform(null)->count()->shouldBe(0);
}

public function it_transforms_empty_array_to_empty_collection(): void
{
$this->transform([])->shouldBeAnInstanceOf(ArrayCollection::class);
$this->transform([])->count()->shouldBe(0);
}

public function it_transforms_non_empty_array_to_collection(
MediaRepositoryInterface $mediaRepository,
MediaInterface $media1,
MediaInterface $media2
): void
{
$mediaCodes = ['code1', 'code2'];
$mediaRepository->findBy(['code' => $mediaCodes])->willReturn([$media1, $media2]);

$this->transform($mediaCodes)->shouldBeAnInstanceOf(ArrayCollection::class);
$this->transform($mediaCodes)->shouldHaveCount(2);
$this->transform($mediaCodes)->toArray()->shouldBe([$media1, $media2]);
}

public function it_reverse_transforms_empty_collection_to_empty_array(): void
{
$collection = new ArrayCollection();
$this->reverseTransform($collection)->shouldBeArray();
$this->reverseTransform($collection)->shouldBe([]);
}

public function it_reverse_transforms_collection_to_array_of_media_codes(
MediaInterface $media1,
MediaInterface $media2
): void
{
$media1->getCode()->willReturn('code1');
$media2->getCode()->willReturn('code2');

$collection = new ArrayCollection([$media1->getWrappedObject(), $media2->getWrappedObject()]);

$this->reverseTransform($collection)->shouldBe(['code1', 'code2']);
}
}
Loading
Loading