Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,15 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
->stopOnFail();

$this->taskCodecept($pathToCodeception)
->arg('--steps')
->arg('--debug')
->arg('--fail-fast')
->arg('--env ' . $opts['env'])
->arg($this->testsPath . 'acceptance/modules.feature')
->run()
->stopOnFail();

$this->taskCodecept($pathToCodeception)
->arg('--steps')
->arg('--debug')
->arg('--fail-fast')
Expand Down
43 changes: 0 additions & 43 deletions tests/codeception/_support/AcceptanceHelper.php

This file was deleted.

22 changes: 20 additions & 2 deletions tests/codeception/_support/Helper/Acceptance.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/

namespace Helper;
use Codeception\Configuration;
use Codeception\Module;

/**
* Helper class for Acceptance.
Expand All @@ -18,7 +19,24 @@
*
* @since __DEPLOY_VERSION__
*/
class Acceptance extends \Codeception\Module
class Acceptance extends Module
{
protected static $acceptanceSuiteConfiguration = [];

/**
* Function to get Configuration from the acceptance.suite.yml to be used by a test
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
public function getSuiteConfiguration()
{
if (empty(self::$acceptanceSuiteConfiguration))
{
self::$acceptanceSuiteConfiguration = Configuration::suiteSettings('acceptance', Configuration::config());
}

return self::$acceptanceSuiteConfiguration;
}
}
134 changes: 134 additions & 0 deletions tests/codeception/_support/Helper/JoomlaDb.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?php
/**
* @package Joomla.Test
* @subpackage Helper
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Helper;

use Codeception\Module\Db;

/**
* JoomlaDb Helper class for Acceptance.
*
* You can create DB Helper methods here
*
* @package Codeception\Module
*
* @since __DEPLOY_VERSION__
*/
class JoomlaDb extends Db
{
/**
* @var string The table prefix
*/
protected $prefix;

/**
* Codeception Hook: called after configuration is loaded
*/
public function _initialize()
{
$this->prefix = (isset($this->config['prefix'])) ? $this->config['prefix'] : '';

return parent::_initialize();
}

/**
* Inserts an SQL record into a database. This record will be erased after the test.
*
* @param string $table
* @param array $data
*
* @return integer $id The last insert id
*/
public function haveInDatabase($table, array $data)
{
$table = $this->addPrefix($table);

return parent::haveInDatabase($table, $data);
}

/**
* See an entry in the database
*
* @param string $table
* @param array $criteria
*/
public function seeInDatabase($table, $criteria = [])
{
$table = $this->addPrefix($table);

parent::seeInDatabase($table, $criteria);
}

/**
* @param string $table
* @param array $criteria
*/
public function dontSeeInDatabase($table, $criteria = [])
{
$table = $this->addPrefix($table);

parent::dontSeeInDatabase($table, $criteria);
}

/**
* Grab an entry from the database
*
* @param $table
* @param $column
* @param null $criteria
*
* @return mixed
*/
public function grabFromDatabase($table, $column, $criteria = null)
{
$table = $this->addPrefix($table);

return parent::grabFromDatabase($table, $column, $criteria);
}

/**
* Asserts that the given number of records were found in the database.
*
* @param int $expectedNumber Expected number
* @param string $table Table name
* @param array $criteria Search criteria [Optional]
*/
public function seeNumRecords($expectedNumber, $table, array $criteria = [])
{
$table = $this->addPrefix($table);

parent::seeNumRecords($expectedNumber, $table, $criteria);
}

/**
* Returns the number of rows in a database
*
* @param string $table Table name
* @param array $criteria Search criteria [Optional]
*
* @return int
*/
public function grabNumRecords($table, array $criteria = [])
{
$table = $this->addPrefix($table);

return parent::grabNumRecords($table, $criteria);
}

/**
* Add the table prefix
*
* @param $table string
*
* @return string
*/
protected function addPrefix($table)
{
return $this->prefix . $table;
}
}
Loading