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 { ...@@ -87,27 +87,21 @@ class FeedsMapperTestCase extends FeedsWebTestCase {
* Create a new content-type, and add a field to it. Mostly copied from * Create a new content-type, and add a field to it. Mostly copied from
* cck/tests/content.crud.test ContentUICrud::testAddFieldUI * cck/tests/content.crud.test ContentUICrud::testAddFieldUI
* *
* @param $typename * @param $settings
* (Optional) the name of the content-type to create, defaults to a random name. * (Optional) An array of settings to pass through to
* drupalCreateContentType().
* @param $fields * @param $fields
* (Optional) an keyed array of $field_name => $field_type used to add additional * (Optional) an keyed array of $field_name => $field_type used to add additional
* fields to the new content type. * fields to the new content type.
* *
* @return * @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()) { final protected function createContentType(array $settings = array(), array $fields = array()) {
if ($typename == NULL) { $type = $this->drupalCreateContentType($settings);
$typename = strtolower($this->randomName()); $typename = $type->type;
}
// 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');
$admin_type_url = 'admin/structure/types/manage/'. str_replace('_', '-', $typename); $admin_type_url = 'admin/structure/types/manage/'. str_replace('_', '-', $typename);
......
...@@ -33,7 +33,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase { ...@@ -33,7 +33,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase {
$this->drupalGet('admin/config/regional/settings'); $this->drupalGet('admin/config/regional/settings');
// Create content type. // Create content type.
$typename = $this->createContentType(NULL, array( $typename = $this->createContentType(array(), array(
'date' => 'date', 'date' => 'date',
'datestamp' => 'datestamp', 'datestamp' => 'datestamp',
//'datetime' => 'datetime', // REMOVED because the field is broken ATM. //'datetime' => 'datetime', // REMOVED because the field is broken ATM.
......
...@@ -26,7 +26,7 @@ class FeedsMapperFieldTestCase extends FeedsMapperTestCase { ...@@ -26,7 +26,7 @@ class FeedsMapperFieldTestCase extends FeedsMapperTestCase {
*/ */
function test() { function test() {
// Create content type. // Create content type.
$typename = $this->createContentType(NULL, array( $typename = $this->createContentType(array(), array(
'alpha' => 'text', 'alpha' => 'text',
'beta' => 'number_integer', 'beta' => 'number_integer',
'gamma' => 'number_decimal', 'gamma' => 'number_decimal',
......
...@@ -25,7 +25,7 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase { ...@@ -25,7 +25,7 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase {
* Basic test loading a single entry CSV file. * Basic test loading a single entry CSV file.
*/ */
public function test() { 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. // 1) Test mapping remote resources to file field.
......
...@@ -29,7 +29,7 @@ class FeedsMapperLinkTestCase extends FeedsMapperTestCase { ...@@ -29,7 +29,7 @@ class FeedsMapperLinkTestCase extends FeedsMapperTestCase {
$static_title = $this->randomName(); $static_title = $this->randomName();
// Create content type. // Create content type.
$typename = $this->createContentType(NULL, array( $typename = $this->createContentType(array(), array(
'alpha' => array( 'alpha' => array(
'type' => 'link_field', 'type' => 'link_field',
'settings' => array( '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