Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create tests for com_modules #106

Open
wants to merge 9 commits into
base: staging
from
Copy path View file
@@ -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')

This file was deleted.

Oops, something went wrong.
@@ -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.
@@ -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;
}
}
@@ -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;
}
}
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.