Skip to content
Snippets Groups Projects
Commit effb3556 authored by Dave Reid's avatar Dave Reid
Browse files

Simplify FeedsMapperTestCase::createContentType() using...

Simplify FeedsMapperTestCase::createContentType() using DrupalWebTestCase::drupalCreateContentType().
parent 248c4dcc
No related branches found
No related tags found
No related merge requests found
......@@ -87,27 +87,21 @@ class FeedsMapperTestCase extends FeedsWebTestCase {
* Create a new content-type, and add a field to it. Mostly copied from
* cck/tests/content.crud.test ContentUICrud::testAddFieldUI
*
* @param $typename
* (Optional) the name of the content-type to create, defaults to a random name.
* @param $settings
* (Optional) An array of settings to pass through to
* drupalCreateContentType().
* @param $fields
* (Optional) an keyed array of $field_name => $field_type used to add additional
* fields to the new content type.
*
* @return
* The name of the new typename.
* The machine name of the new content type.
*
* @see DrupalWebTestCase::drupalCreateContentType()
*/
final protected function createContentType($typename = NULL, $fields = array()) {
if ($typename == NULL) {
$typename = strtolower($this->randomName());
}
// Create the content type.
$edit = array(
'type' => $typename,
'name' => $typename,
);
$this->drupalPost('admin/structure/types/add', $edit, 'Save content type');
$this->assertText('The content type ' . $typename . ' has been added', 'Content type created');
final protected function createContentType(array $settings = array(), array $fields = array()) {
$type = $this->drupalCreateContentType($settings);
$typename = $type->type;
$admin_type_url = 'admin/structure/types/manage/'. str_replace('_', '-', $typename);
......
......@@ -33,7 +33,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase {
$this->drupalGet('admin/config/regional/settings');
// Create content type.
$typename = $this->createContentType(NULL, array(
$typename = $this->createContentType(array(), array(
'date' => 'date',
'datestamp' => 'datestamp',
//'datetime' => 'datetime', // REMOVED because the field is broken ATM.
......
......@@ -26,7 +26,7 @@ class FeedsMapperFieldTestCase extends FeedsMapperTestCase {
*/
function test() {
// Create content type.
$typename = $this->createContentType(NULL, array(
$typename = $this->createContentType(array(), array(
'alpha' => 'text',
'beta' => 'number_integer',
'gamma' => 'number_decimal',
......
......@@ -25,7 +25,7 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase {
* Basic test loading a single entry CSV file.
*/
public function test() {
$typename = $this->createContentType(NULL, array('files' => 'file'));
$typename = $this->createContentType(array(), array('files' => 'file'));
// 1) Test mapping remote resources to file field.
......
......@@ -29,7 +29,7 @@ class FeedsMapperLinkTestCase extends FeedsMapperTestCase {
$static_title = $this->randomName();
// Create content type.
$typename = $this->createContentType(NULL, array(
$typename = $this->createContentType(array(), array(
'alpha' => array(
'type' => 'link_field',
'settings' => array(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment