Skip to content

Commit

Permalink
[BC] Remove type from block
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbager committed Jul 11, 2018
1 parent 3edba03 commit d726b38
Show file tree
Hide file tree
Showing 130 changed files with 249 additions and 2,035 deletions.
59 changes: 14 additions & 45 deletions features/admin/adding_block.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,84 +9,53 @@ Feature: Adding blocks
And the store operates on a single channel in "United States"

@ui
Scenario: Adding html block
When I go to the create "html" block page
Scenario: Adding block
When I go to the create block page
And I fill the code with "store_description"
And I fill the content with "<p>We have the best candies on the internet!</p>"
And I add it
Then I should be notified that the block has been created

@ui
Scenario: Adding text block
When I go to the create "text" block page
And I fill the code with "store_main_title"
And I fill the name with "Store title"
And I fill the content with "Welcome to the Candy Shop"
And I add it
Then I should be notified that the block has been created

@ui
Scenario: Adding image block
When I go to the create "image" block page
And I fill the code with "aston_martin_db_11"
And I fill the name with "Aston Marting DB 11 image"
And I fill the link with "/page/aston-martin-db-11-review"
And I upload the "aston_martin_db_11.jpg" image
And I add it
Then I should be notified that the block has been created

@ui @javascript
Scenario: Adding block with sections
Given there are existing sections named "Blog" and "Homepage"
When I go to the create "html" block page
And I fill "Code, Content" fields
When I go to the create block page
And I fill the code with "intro"
And I fill the content with "Hello world!"
And I add "Blog" and "Homepage" sections to it
And I add it
Then I should be notified that the block has been created

@ui
Scenario: Trying to add block with existing code
Given there is an existing block with "homepage_image" code
When I go to the create "text" block page
When I go to the create block page
And I fill the code with "homepage_image"
And I try to add it
Then I should be notified that there is already an existing block with provided code

@ui
Scenario: Trying to add text block with blank data
When I go to the create "text" block page
Scenario: Trying to add block with blank data
When I go to the create block page
And I try to add it
Then I should be notified that "Code, Content" fields cannot be blank

@ui
Scenario: Trying to add html block with blank data
When I go to the create "html" block page
Scenario: Trying to add block with blank data
When I go to the create block page
And I try to add it
Then I should be notified that "Code, Content" fields cannot be blank

@ui
Scenario: Trying to add image block with blank data
When I go to the create "image" block page
And I try to add it
Then I should be notified that "Code, Image" fields cannot be blank

@ui
Scenario: Trying to add text block with too long data
When I go to the create "text" block page
Scenario: Trying to add block with too long data
When I go to the create block page
And I fill "Code, Name, Content" fields with 6000 characters
And I try to add it
Then I should be notified that "Code, Name" fields are too long

@ui
Scenario: Trying to add html block with too long data
When I go to the create "html" block page
Scenario: Trying to add block with too long data
When I go to the create block page
And I fill "Code, Name, Content" fields with 6000 characters
And I try to add it
Then I should be notified that "Code, Name" fields are too long

@ui
Scenario: Trying to add image block with too long data
When I go to the create "image" block page
And I fill "Code, Name" fields with 6000 characters
And I try to add it
Then I should be notified that "Code, Name" fields are too long
19 changes: 3 additions & 16 deletions features/admin/managing_blocks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,21 @@ Feature: Managing cms blocks
And I should see empty list of blocks

@ui
Scenario: Updating text block
Given there is a text block with "store_phone_number" code and "123456789" content
Scenario: Updating block
Given there is a block with "store_phone_number" code and "123456789" content
When I go to the update "store_phone_number" block page
And I fill the content with "987654321"
And I update it
Then I should be notified that the block has been successfully updated

@ui
Scenario: Updating html block
Given there is a html block with "store_email" code and "<a href='mailto:mikolaj.krol@bitbag.pl'>mikolaj.krol@bitbag.pl</a>" content
Given there is a block with "store_email" code and "<a href='mailto:mikolaj.krol@bitbag.pl'>mikolaj.krol@bitbag.pl</a>" content
When I go to the update "store_email" block page
And I fill the content with "<a href='mailto:mikolaj.krol@bitbag.pl'>mikolaj.krol@bitbag.pl</a>"
And I update it
Then I should be notified that the block has been successfully updated

@ui
Scenario: Updating image block
Given there is an existing block with "porsche_911_singer" code and "porsche_911_singer_1.jpg" image
When I go to the update "porsche_911_singer" block page
And I upload the "porsche_911_singer_2.jpg" image
And I update it
Then I should be notified that the block has been successfully updated

@ui
Scenario: Disabling block
Given there is an existing block with "bitbag_quote" code
Expand All @@ -54,8 +46,3 @@ Feature: Managing cms blocks
Given there is a block in the store
When I want to edit this block
Then the code field should be disabled

@ui
Scenario: Being able to chose which block type to create
When I go to the blocks page
Then I should be able to select between "Text block", "HTML block" and "Image block" block types under Create button
30 changes: 0 additions & 30 deletions spec/Entity/BlockImageSpec.php

This file was deleted.

12 changes: 0 additions & 12 deletions spec/Entity/BlockSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ function it_implements_block_interface(): void
$this->shouldHaveType(BlockInterface::class);
}

function it_allows_access_via_properties(): void
{
$this->setType('image');
$this->getType()->shouldReturn('image');

$this->setType('new_focus_rs');
$this->getType()->shouldReturn('new_focus_rs');

$this->setEnabled(true);
$this->isEnabled()->shouldReturn(true);
}

function it_toggles(): void
{
$this->enable();
Expand Down
6 changes: 1 addition & 5 deletions spec/Entity/BlockTranslationSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace spec\BitBag\SyliusCmsPlugin\Entity;

use BitBag\SyliusCmsPlugin\Entity\BlockImageInterface;
use BitBag\SyliusCmsPlugin\Entity\BlockTranslationInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Resource\Model\ResourceInterface;
Expand All @@ -36,15 +35,12 @@ function it_implements_block_translation_interface(): void
$this->shouldHaveType(TranslationInterface::class);
}

function it_allows_access_via_properties(BlockImageInterface $blockImage): void
function it_allows_access_via_properties(): void
{
$this->setName('Escobar favorite quote');
$this->getName()->shouldReturn('Escobar favorite quote');

$this->setContent('Plata o plomo');
$this->getContent()->shouldReturn('Plata o plomo');

$this->setImage($blockImage);
$this->getImage()->shouldReturn($blockImage);
}
}
72 changes: 0 additions & 72 deletions spec/EventListener/BlockImageUploadListenerSpec.php

This file was deleted.

39 changes: 0 additions & 39 deletions spec/Exception/TemplateTypeNotFoundSpec.php

This file was deleted.

50 changes: 0 additions & 50 deletions spec/Factory/BlockFactorySpec.php

This file was deleted.

Loading

0 comments on commit d726b38

Please sign in to comment.