-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from extcode/88-add-acceptance-tests
[TASK] Add first acceptance test
- Loading branch information
Showing
17 changed files
with
655 additions
and
0 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
Empty file.
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,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Extcode\CartEvents\Tests\Acceptance; | ||
|
||
/* | ||
* This file is part of the package extcode/cart-events. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use Extcode\CartEvents\Tests\Acceptance\Support\Tester; | ||
|
||
class EventListCest | ||
{ | ||
public function testListAndDetailViewForNonBookableEvent(Tester $I): void | ||
{ | ||
$I->amOnUrl('http://127.0.0.1:8080/events/'); | ||
|
||
$I->see('Event 1'); | ||
$I->see('Teaser 1'); | ||
|
||
$I->dontSee('Event 4'); | ||
|
||
$I->click('Event 1'); | ||
$I->see('Event 1', 'h1'); | ||
$I->see('31.07.2024 10:00'); | ||
$I->see('This event date can not be booked.'); | ||
} | ||
|
||
public function testListAndDetailViewForBookableEventWithoutPriceCategories(Tester $I): void | ||
{ | ||
$I->amOnUrl('http://127.0.0.1:8080/events/'); | ||
|
||
$I->see('Event 2'); | ||
$I->see('Teaser 2'); | ||
|
||
$I->dontSee('Event 4'); | ||
|
||
$I->click('Event 2'); | ||
$I->see('Event 2', 'h1'); | ||
$I->see('31.07.2024 10:00'); | ||
|
||
$I->dontSee('This event date can not be booked.'); | ||
$I->seeElement("input[name='tx_cart_cart[quantity]']"); | ||
$I->seeElement('input[type="submit"]'); | ||
} | ||
} |
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,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Extcode\CartEvents\Tests\Acceptance\Support; | ||
|
||
/* | ||
* This file is part of the package extcode/cart-events. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use Codappix\Typo3PhpDatasets\PhpDataSet; | ||
use Codeception\Event\SuiteEvent; | ||
use TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment; | ||
|
||
final class Environment extends BackendEnvironment | ||
{ | ||
protected $localConfig = [ | ||
'coreExtensionsToLoad' => [ | ||
'typo3/cms-core', | ||
'typo3/cms-backend', | ||
'typo3/cms-extbase', | ||
'typo3/cms-frontend', | ||
'typo3/cms-fluid', | ||
'typo3/cms-fluid-styled-content', | ||
'typo3/cms-install', | ||
], | ||
'testExtensionsToLoad' => [ | ||
'extcode/cart', | ||
'extcode/cart-events', | ||
__DIR__ . '/../../Fixtures/cart_events_test', | ||
], | ||
'phpDatabaseFixtures' => [ | ||
'typo3conf/ext/cart_events/Tests/Fixtures/BackendUserDatabase.php', | ||
'typo3conf/ext/cart_events/Tests/Fixtures/PagesDatabase.php', | ||
'typo3conf/ext/cart_events/Tests/Fixtures/ContentDatabase.php', | ||
'typo3conf/ext/cart_events/Tests/Fixtures/EventsDatabase.php', | ||
], | ||
'pathsToLinkInTestInstance' => [ | ||
'typo3conf/ext/cart_events/Tests/Fixtures/config/sites' => 'typo3conf/sites', | ||
], | ||
'configurationToUseInTestInstance' => [ | ||
'SYS' => [ | ||
'trustedHostsPattern' => '.*', | ||
], | ||
], | ||
]; | ||
|
||
public function bootstrapTypo3Environment(SuiteEvent $suiteEvent): void | ||
{ | ||
parent::bootstrapTypo3Environment($suiteEvent); | ||
|
||
assert(is_array($this->config['phpDatabaseFixtures'])); | ||
foreach ($this->config['phpDatabaseFixtures'] as $dataSetFile) { | ||
(new PhpDataSet())->import(include $dataSetFile); | ||
} | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Extcode\CartEvents\Tests\Acceptance\Support; | ||
|
||
/* | ||
* This file is part of the package extcode/cart-events. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use Codeception\Actor; | ||
use Extcode\CartEvents\Tests\Acceptance\Support\_generated\TesterActions; | ||
use TYPO3\TestingFramework\Core\Acceptance\Step\FrameSteps; | ||
|
||
/** | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method void pause() | ||
*/ | ||
class Tester extends Actor | ||
{ | ||
use TesterActions; | ||
|
||
use FrameSteps; | ||
|
||
protected int $retryNum = 2; | ||
} |
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,2 @@ | ||
* | ||
!.gitignore |
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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
return [ | ||
'be_users' => [ | ||
[ | ||
'uid' => '1', | ||
'pid' => '0', | ||
'username' => 'test-admin', | ||
'password' => '$2y$12$ksKbFwhPyf9EWWM52R2e4ubG09tPTK9W6139nxpsgwyUHW17W1nye', | ||
'lang' => 'default', | ||
'admin' => '1', | ||
], | ||
], | ||
]; |
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,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
return [ | ||
'tt_content' => [ | ||
0 => [ | ||
'uid' => '1', | ||
'pid' => '3', | ||
'CType' => 'list', | ||
'list_type' => 'cartevents_events', | ||
'pages' => '7', | ||
'pi_flexform' => '<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <T3FlexForms> <data> <sheet index="sDEF"> <language index="lDEF"> <field index="switchableControllerActions"> <value index="vDEF">Event->show;Event->list</value> </field> <field index="settings.templateLayout"> <value index="vDEF">table</value> </field> <field index="settings.orderBy"> <value index="vDEF"></value> </field> <field index="settings.orderDirection"> <value index="vDEF"></value> </field> <field index="settings.showPageUids"> <value index="vDEF"></value> </field> <field index="settings.categoriesList"> <value index="vDEF"></value> </field> <field index="settings.listSubcategories"> <value index="vDEF">0</value> </field> </language> </sheet> </data> </T3FlexForms>', | ||
], | ||
1 => [ | ||
'uid' => '2', | ||
'pid' => '11', | ||
'CType' => 'list', | ||
'list_type' => 'cart_cart', | ||
'pages' => '', | ||
'pi_flexform' => '<?xml version="1.0" encoding="utf-8" standalone="yes" ?><T3FlexForms><data><sheet index="sDEF"><language index="lDEF"><field index="settings.seller.emailFromName"></value index="vDEF"></value></field><field index="settings.seller.emailFromAddress"></value index="vDEF"></value></field><field index="settings.seller.emailToAddress"></value index="vDEF"></value></field><field index="settings.seller.emailCcAddress"></value index="vDEF"></value></field><field index="settings.seller.emailBccAddress"></value index="vDEF"></value></field><field index="settings.buyer.emailFromName"></value index="vDEF"></value></field><field index="settings.buyer.emailFromAddress"></value index="vDEF"></value></field><field index="settings.buyer.emailCcAddress"></value index="vDEF"></value></field><field index="settings.buyer.emailBccAddress"></value index="vDEF"></value></field><field index="settings.buyer.emailReplyToAddress"></value index="vDEF"></value></field></language></sheet></data></T3FlexForms>', | ||
], | ||
], | ||
]; |
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,106 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
return [ | ||
'tx_cartevents_domain_model_event' => [ | ||
0 => [ | ||
'uid' => '1', | ||
'pid' => '7', | ||
'sku' => 'event-1', | ||
'title' => 'Event 1', | ||
'teaser' => 'Teaser 1', | ||
'description' => '', | ||
'meta_description' => '', | ||
'audience' => '', | ||
'path_segment' => 'event-1', | ||
], | ||
1 => [ | ||
'uid' => '2', | ||
'pid' => '7', | ||
'sku' => 'event-2', | ||
'title' => 'Event 2', | ||
'teaser' => 'Teaser 2', | ||
'description' => '', | ||
'meta_description' => '', | ||
'audience' => '', | ||
'path_segment' => 'event-2', | ||
], | ||
2 => [ | ||
'uid' => '3', | ||
'pid' => '7', | ||
'sku' => 'event-3', | ||
'title' => 'Event 3', | ||
'teaser' => 'Teaser 3', | ||
'description' => '', | ||
'meta_description' => '', | ||
'audience' => '', | ||
'path_segment' => 'event-3', | ||
], | ||
3 => [ | ||
'uid' => '4', | ||
'pid' => '9', | ||
'sku' => 'event-4', | ||
'title' => 'Event 4', | ||
'teaser' => '', | ||
'description' => '', | ||
'meta_description' => '', | ||
'audience' => '', | ||
'path_segment' => 'event-4', | ||
], | ||
], | ||
'tx_cartevents_domain_model_eventdate' => [ | ||
0 => [ | ||
'uid' => '1', | ||
'pid' => '7', | ||
'event' => '1', | ||
'sku' => 'eventdate-1', | ||
'title' => 'Eventdate 1', | ||
'begin' => '1722420000', | ||
'location' => '', | ||
'lecturer' => '', | ||
'note' => '', | ||
'price' => 9.99, | ||
'bookable' => false, | ||
], | ||
1 => [ | ||
'uid' => '2', | ||
'pid' => '7', | ||
'event' => '2', | ||
'sku' => 'eventdate-2', | ||
'title' => 'Eventdate 2', | ||
'begin' => '1722420000', | ||
'location' => '', | ||
'lecturer' => '', | ||
'note' => '', | ||
'price' => 19.99, | ||
'bookable' => true, | ||
], | ||
2 => [ | ||
'uid' => '3', | ||
'pid' => '7', | ||
'event' => '3', | ||
'sku' => 'eventdate-3', | ||
'title' => 'Eventdate 3', | ||
'begin' => '1722420000', | ||
'location' => '', | ||
'lecturer' => '', | ||
'note' => '', | ||
'price' => 29.99, | ||
'bookable' => true, | ||
], | ||
3 => [ | ||
'uid' => '4', | ||
'pid' => '9', | ||
'event' => '4', | ||
'sku' => 'eventdate-4', | ||
'title' => 'Eventdate 4', | ||
'begin' => '1722420000', | ||
'location' => '', | ||
'lecturer' => '', | ||
'note' => '', | ||
'price' => 9.99, | ||
'bookable' => true, | ||
], | ||
], | ||
]; |
Oops, something went wrong.