You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Next »
Our behat tests should use data generators to create data that is assumed by tests directly in the database.
All data generators:
- should be located in a sub-directory of testing/datagenerator/generators
- must extend the \testing\datagenerator\generator class
- the file name must be the lowercase classname
- the file must declasre itself part of the testing\datagenerator namespace
<?php
// This file is part of Rogō
//
// Rogō is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Rogō is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Rogō. If not, see <http://www.gnu.org/licenses/>.
namespace testing\datagenerator;
/**
* Generates Rogo users.
*
* @author Your Name <youremail@example.com>
* @copyright Copyright message
* @package testing
* @subpackage datagenerator
*/
class example extends generator {
/**
* To be usable in the main behat datageneration step the methods
* must accept a single array or stdClass parameter only.
*
* @param array|stdClass $parameters
* @return array Contains the values that were inserted into the database.
* @throws data_error
*/
public function create_example($parameters) {
// Your code goes here
}
}