2017 © Pedro PelĂĄez
 

library codeception-helper-module

Generic helper module for codeception acceptance testing

image

portrino/codeception-helper-module

Generic helper module for codeception acceptance testing

  • Friday, December 1, 2017
  • by portrino-dev
  • Repository
  • 7 Watchers
  • 2 Stars
  • 341 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 15 Versions
  • 26 % Grown

The README.md

Codeception Helper Module

Build Status MaintainabilityMaintainability Test Coverage Test Coverage Issue Count Latest Stable Version Total Downloads, (*1)

Collection of modules for codeception acceptance testing with TYPO3 and Shopware. You can use this module as base for your codeception acceptance testsuite. It provides a set of modules, abstract page objects and interfaces to make acceptance testing a bit cleaner and easier in context of TYPO3 and Shopware., (*2)

Installation

You need to add the repository into your composer.json file, (*3)

composer require --dev portrino/codeception-helper-module

Modules

You can use module(s) as any other codeception module, by adding '\Codeception\Module\Portrino******' to the enabled modules in your codeception suite configurations., (*4)

Database module

modules:
    enabled:
        - \Portrino\Codeception\Module\Database:
            depends: Db
            no_reset: true # do not reset database after testsuite
 ```  

Update codeception build

```bash
codecept build

Methods

truncateTableInDatabase($table)

Truncates the $table., (*5)

  $I->truncateTableInDatabase($table);

deleteFromDatabase($table, $criteria)

Deletes the row(s) from $table matching the $criteria, (*6)

$I->deleteFromDatabase($table, $criteria);

TYPO3 module

modules:
    enabled:
        - \Portrino\Codeception\Module\Typo3:
            depends: Asserts
            domain: www.example.com

Update codeception build, (*7)

codecept build

Methods

executeCommand

Executes the specified typo3_console $command., (*8)

$I->executeCommand($command, $arguments = [], $environmentVariables = [])

executeSchedulerTask

Executes tasks that are registered in the scheduler module., (*9)

$I->executeSchedulerTask($taskId, $force = false, $environmentVariables = [])

flushCache

Flushes TYPO3 core caches first and after that, flushes caches from extensions., (*10)

$I->flushCache($force = false, $filesOnly = false)

flushCacheGroups

Flushes all caches in specified groups. Valid group names are by default: * all * lowlevel * pages * system, (*11)

$I->flushCacheGroups($groups)

importIntoDatabase

Import $file into database., (*12)

$I->importIntoDatabase($file)

Shopware module

modules:
    enabled:
        - \Portrino\Codeception\Module\Shopware:
            depends: Asserts
            bin-dir: 

Update codeception build, (*13)

codecept build

Methods

executeCommand

Executes the specified shopware_console $command., (*14)

$I->executeCommand($command, $arguments = [], $environmentVariables = []);

runSqlCommand

Executes SQL query in shopware_console., (*15)

$I->runSqlCommand($sql);

activatePlugin

Activates Shopware plugin., (*16)

$I->activatePlugin($plugin);

installPlugin

Install Shopware plugin. If activate = true, the plugin will be activated after installation., (*17)

$I->installPlugin($plugin, $activate);

refreshPluginList

Refresh Shopware plugin-list. You need to call this sometimes before installing a plugin., (*18)

$I->refreshPluginList();

regenerateThemeCache

Regenerates the theme-cache., (*19)

$I->regenerateThemeCache();

clearCache

Clear Shopware cache., (*20)

$I->clearCache();

setPluginConfiguration

Set configuration of Shopware plugin by plugin-name, configuration-key and configuration-value. * you'll be able to set cofigurations for a specified shop by using the $shop parameter, (*21)

$I->setPluginConfiguration($plugin, $key, $value, $shop = 1);

Interfaces

You should use our constants defined in some interfaces to prevent typos and make refactoring easier., (*22)

TYPO3

  • \Portrino\Codeception\Interfaces\DatabaseTables\Typo3Database
  • \Portrino\Codeception\Interfaces\Cookies\Typo3Cookie
  • \Portrino\Codeception\Interfaces\Commands\Typo3Command

Example:, (*23)

  $I->seeInDatabase(
        \Portrino\Codeception\Interfaces\DatabaseTables\Typo3::PAGES,
        [
            'uid' => 123,
        ]
  );

Shopware

  • \Portrino\Codeception\Interfaces\DatabaseTables\ShopwareDatabase
  • \Portrino\Codeception\Interfaces\Cookies\ShopwareCookie
  • \Portrino\Codeception\Interfaces\Commands\ShopwareCommand
  $I->seeInDatabase(
        \Portrino\Codeception\Interfaces\DatabaseTables\Shopware::ARTICLE,
        [
            'id' => 123,
        ]
  );

Fixtures Helper

For the sake of simplicity we added an little Helper for the Codeception Fixture feature., (*24)

Please add in your _bootstrap.php file, (*25)

'__model' => \Portrino\Codeception\Model\Typo3\Typo3FrontendUser::class,, (*26)

as the first entry in your Fixture array. your Fixture has to look like, (*27)

\Codeception\Util\Fixtures::add(
    'your_fixture_name',
    [
        '__model' =>  \Portrino\Codeception\Model\Typo3\Typo3FrontendUser::class, 
        'fixtureValueX' => 'X',
        'fixtureValueY' => 'Y'
    ]
);

now you'll be able to use your Fixture with our adapted Fixtures class, (*28)

\Portrino\Codeception\Util\Fixtures::get('your_fixture_name');

Hints

Use codeception with shopware

Due the fact that shopware only supports some very old versions of packages like guzzlehttp/guzzle or symfony/process, we advise you to put all the testing stuff into a indepented composer.json file under a seperate location like web/tests/Codeception/. Do not add codeception\codeception package into the root composer.json of shopware - you will get trouble., (*29)

Autoloading

To autoload vendor packages you have to require_once the autoload.php in your composers _bootstrap.php file., (*30)

require_once(__DIR__ . '/../../../../web/autoload.php');

Authors

, (*31)

  • AndrĂ© Wuttig - Initial work, Unit Tests - aWuttig
  • Leopold Engst - Unit Tests, Documentation - leen2104
  • Axel Böswetter - Bugfixes - EvilBMP

See also the list of contributors who participated in this project., (*32)

The Versions

25/10 2017

0.4.3

0.4.3.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

25/10 2017

0.4.2

0.4.2.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

25/10 2017

0.4.1

0.4.1.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

23/10 2017

0.4.0

0.4.0.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

18/10 2017

0.3.5

0.3.5.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

18/10 2017

0.3.4

0.3.4.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

18/10 2017

0.3.3

0.3.3.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

16/10 2017

0.3.2

0.3.2.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

16/10 2017

0.3.1

0.3.1.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

13/10 2017

0.3.0

0.3.0.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

13/10 2017

0.2.0

0.2.0.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires

12/10 2017

0.1.0

0.1.0.0

Generic helper module for codeception acceptance testing

  Sources   Download

The Requires

 

The Development Requires