-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
110 changed files
with
3,178 additions
and
2,101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Feature: channel module | ||
|
||
Scenario: Create channel (not authorized) | ||
When I send a POST request to "/api/v1/en_GB/channels" | ||
Then the response status code should be 401 | ||
|
||
Scenario: Get channels (not authorized) | ||
When I send a GET request to "/api/v1/en_GB/channels" | ||
Then the response status code should be 401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,191 +1,30 @@ | ||
Feature: channel module | ||
## todo To be checked with the export profile | ||
Scenario: Create channel | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a POST request to "/api/v1/en/channels" with body: | ||
""" | ||
{ | ||
"export_profile_id": "", | ||
"name": "Test pl_PL" | ||
} | ||
""" | ||
Then the response status code should be 400 | ||
|
||
Scenario: Create channel (not authorized) | ||
When I send a POST request to "/api/v1/en/channels" | ||
Then the response status code should be 401 | ||
|
||
Scenario: Create channel (no Name) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a POST request to "/api/v1/en/channels" with body: | ||
""" | ||
{ | ||
"export_profile_id": "" | ||
} | ||
""" | ||
Then the response status code should be 400 | ||
|
||
Scenario: Create channel (empty Name) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a POST request to "/api/v1/en/channels" with body: | ||
""" | ||
{ | ||
"export_profile_id": "", | ||
"name": "" | ||
} | ||
""" | ||
Then the response status code should be 400 | ||
|
||
Scenario: Create channel (name with language with empty string value) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a POST request to "/api/v1/en/channels" with body: | ||
""" | ||
{ | ||
"name": "Test pl_PL" | ||
} | ||
""" | ||
Then the response status code should be 400 | ||
|
||
# Scenario: Update channel | ||
# Given I am Authenticated as "test@ergonode.com" | ||
# And I add "Content-Type" header equal to "application/json" | ||
# And I add "Accept" header equal to "application/json" | ||
# When I send a PUT request to "/api/v1/en/channels/@channel@" with body: | ||
# """ | ||
# { | ||
# "export_profile_id": "", | ||
# "name": "Test de" | ||
# } | ||
# """ | ||
# Then the response status code should be 204 | ||
# | ||
# Scenario: Update channel (not authorized) | ||
# When I send a PUT request to "/api/v1/en/channels/@channel@" | ||
# Then the response status code should be 401 | ||
|
||
Scenario: Update channel (not found) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a PUT request to "/api/v1/en/channels/@@static_uuid@@" | ||
Then the response status code should be 404 | ||
|
||
# Scenario: Update channel (empty name) | ||
# Given I am Authenticated as "test@ergonode.com" | ||
# And I add "Content-Type" header equal to "application/json" | ||
# And I add "Accept" header equal to "application/json" | ||
# When I send a PUT request to "/api/v1/en/channels/@channel@" with body: | ||
# """ | ||
# { | ||
# "name": "" | ||
# } | ||
# """ | ||
# Then the response status code should be 400 | ||
# | ||
# Scenario: Update channel (wrong parameter) | ||
# Given I am Authenticated as "test@ergonode.com" | ||
# And I add "Content-Type" header equal to "application/json" | ||
# And I add "Accept" header equal to "application/json" | ||
# When I send a PUT request to "/api/v1/en/channels/@channel@" with body: | ||
# """ | ||
# { | ||
# "test": { | ||
# } | ||
# } | ||
# """ | ||
# Then the response status code should be 400 | ||
|
||
# Scenario: Update channel (empty translation) | ||
# Given I am Authenticated as "test@ergonode.com" | ||
# And I add "Content-Type" header equal to "application/json" | ||
# And I add "Accept" header equal to "application/json" | ||
# When I send a PUT request to "/api/v1/en/channels/@channel@" with body: | ||
# """ | ||
# { | ||
# "name": "Test pl_PL (changed)" | ||
# } | ||
# """ | ||
# Then the response status code should be 400 | ||
|
||
# Scenario: Get channel | ||
# Given I am Authenticated as "test@ergonode.com" | ||
# And I add "Content-Type" header equal to "application/json" | ||
# And I add "Accept" header equal to "application/json" | ||
# When I send a GET request to "/api/v1/pl_PL/channels/@channel@" | ||
# Then the response status code should be 200 | ||
# | ||
# Scenario: Get channel (not authorized) | ||
# When I send a GET request to "/api/v1/en/channels/@channel@" | ||
# Then the response status code should be 401 | ||
|
||
Scenario: Get channel (not found) | ||
Background: | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a GET request to "/api/v1/en/channels/@@static_uuid@@" | ||
Then the response status code should be 404 | ||
|
||
# Scenario: Delete channel (not authorized) | ||
# When I send a DELETE request to "/api/v1/en/channels/@channel@" | ||
# Then the response status code should be 401 | ||
|
||
Scenario: Delete channel (not found) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a DELETE request to "/api/v1/en/channels/@@static_uuid@@" | ||
Then the response status code should be 404 | ||
|
||
# Scenario: Delete channel | ||
# Given I am Authenticated as "test@ergonode.com" | ||
# And I add "Content-Type" header equal to "application/json" | ||
# And I add "Accept" header equal to "application/json" | ||
# When I send a DELETE request to "/api/v1/en/channels/@channel@" | ||
# Then the response status code should be 204 | ||
|
||
Scenario: Get channels (order by name) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a GET request to "/api/v1/en/channels?field=name" | ||
Then the JSON should be valid according to the schema "module/grid/features/gridSchema.json" | ||
Scenario: Get channel type dictionary | ||
When I send a GET request to "/api/v1/en_GB/dictionary/channels" | ||
Then the response status code should be 200 | ||
|
||
Scenario: Get channels (order ASC) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a GET request to "/api/v1/en/channels?field=name&order=ASC" | ||
When I send a GET request to "/api/v1/en_GB/channels?field=name&order=ASC" | ||
Then the JSON should be valid according to the schema "module/grid/features/gridSchema.json" | ||
And the response status code should be 200 | ||
|
||
Scenario: Get channels (order DESC) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a GET request to "/api/v1/en/channels?field=name&order=DESC" | ||
When I send a GET request to "/api/v1/en_GB/channels?field=name&order=DESC" | ||
Then the JSON should be valid according to the schema "module/grid/features/gridSchema.json" | ||
And the response status code should be 200 | ||
|
||
Scenario: Get channels (filter by name) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a GET request to "/api/v1/en/channels?limit=25&offset=0&filter=name%3Dasd" | ||
When I send a GET request to "/api/v1/en_GB/channels?limit=25&offset=0&filter=name%3Dasd" | ||
Then the JSON should be valid according to the schema "module/grid/features/gridSchema.json" | ||
And the response status code should be 200 | ||
|
||
Scenario: Get channels (filter by code) | ||
Given I am Authenticated as "test@ergonode.com" | ||
And I add "Content-Type" header equal to "application/json" | ||
And I add "Accept" header equal to "application/json" | ||
When I send a GET request to "/api/v1/en/channels?limit=25&offset=0&filter=code%3DCAT" | ||
When I send a GET request to "/api/v1/en_GB/channels?limit=25&offset=0&filter=code%3DCAT" | ||
Then the JSON should be valid according to the schema "module/grid/features/gridSchema.json" | ||
|
||
Scenario: Get channels (not authorized) | ||
When I send a GET request to "/api/v1/en/channels" | ||
Then the response status code should be 401 | ||
And the response status code should be 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/Application/Command/ChannelExportScheduleConsoleCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © Ergonode Sp. z o.o. All rights reserved. | ||
* See license.txt for license details. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Ergonode\Channel\Application\Command; | ||
|
||
use Ergonode\EventSourcing\Infrastructure\Bus\CommandBusInterface; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Ergonode\Channel\Domain\Command\Schedule\ScheduleCommand; | ||
|
||
/** | ||
*/ | ||
class ChannelExportScheduleConsoleCommand extends Command | ||
{ | ||
private const NAME = 'channel:export:schedule'; | ||
|
||
/** | ||
* @var CommandBusInterface | ||
*/ | ||
private CommandBusInterface $commandBus; | ||
|
||
/** | ||
* @param CommandBusInterface $commandBus | ||
*/ | ||
public function __construct(CommandBusInterface $commandBus) | ||
{ | ||
parent::__construct(static::NAME); | ||
|
||
$this->commandBus = $commandBus; | ||
} | ||
|
||
/** | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* | ||
* @return int | ||
*/ | ||
public function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$time = new \DateTime(); | ||
|
||
$output->writeln(sprintf('Run schedule for %s', $time->format('Y-m-d H:i:s'))); | ||
|
||
$command = new ScheduleCommand($time); | ||
$this->commandBus->dispatch($command, true); | ||
|
||
return 0; | ||
} | ||
} |
Oops, something went wrong.