SimpleTest is Drupal's custom testing framework.
0
votes
0answers
17 views
simpletest- drupalLogin method not working if domain access module is enabled
Simple test drupallogin method is not working if domain access module is enabled..
I have been testing the core drupal user module..
Seems the issues is with drupal sessions / domain access ...
3
votes
1answer
31 views
Why are comments enabled on my content types in Simpletests?
When I run Simpletest, it's showing comment forms at the bottom of all the nodes, even though I don't even have the comment module enabled, nor permissions assigned for it. These comment forms showing ...
2
votes
0answers
27 views
How to test AJAX Callback with simpletest on Drupal 6
I know there is drupalPostAJAX() available on Drupal 7 to do this, but I want to use it on Drupal 6.
So I found on this link : http://tiger-fish.com/blog/drupal-6-posting-ajax-callbacks-simpletest a ...
0
votes
0answers
22 views
How to SAVE a webform in Simpletest?
I am able to save a sample webform in Simpletest if I only use title and body:
$edit = array();
$edit['title'] = 'Sample webform';
$edit["body[$langcode][0][value]"] = $this->randomName();
...
1
vote
1answer
12 views
EFQ propertyCondition Doesn't work in Simpletest
This Entity Field Query works as expected outside of simpletest:
$query->entityCondition('entity_type', 'node')
->fieldCondition('field_exhibition_window_start', 'value', $date, '<=')
...
1
vote
0answers
18 views
How to reuse custom methods in a simpletest class?
I have created several test methods that I find useful in a lot of other situations.
All I need is to define an include file of higher visibility which contains an utility class which is autoloaded ...
0
votes
1answer
26 views
How do I run unit tests against datasets? (DrupalWebTestCase and DrupalTestCase)
I am testing a module that I am writing against the Unit Testing framework that comes with Drupal 7. All makes sense, and everything asserts as it should.
My question though, is it possible to run ...
1
vote
2answers
36 views
What is the most robust way to assert for a validation error?
I want to test the validation function in my custom module, and so I've written a simpletest that inputs an illegal value in a field and then attempts to save the node. Currently I'm using ...
1
vote
0answers
23 views
Press 'continue' button in simpletest
I am trying to enable modules via POSTing to /admin/modules in a simpletest. It works fine, except that there are dependencies (the whole reason I want to do it this way) and when it requires then ...
0
votes
1answer
72 views
Simpletest fails to create the field_config table
I'm only just getting into TDD with Drupal and unfortunately run into trouble right away. For some reason the simpletest####field_config table isn't being created, and I don't get why; many other ...
2
votes
1answer
57 views
Why do PAreview/codesniffer gripe about missing “scope modifier”?
I am writing a simpletest file for my Drupal module. It works OK, but when I use PAreview (automatic tool based upon PHP codesniffer to check correctness of Drupal code), I get the following error ...
0
votes
0answers
29 views
Impossible to enable modules in SimpleTest
I am building SimpleTests for my modules:
It seems like the standard procedure for enabling modules it doesn't work for me:
function setUp() {
parent::setUp('mymodule');
}
I constantly get a ...
4
votes
1answer
50 views
webTestCase->drupalPost() or drupal_http_request()?
I'm writing a simpletest for a module that posts XML directly to a URL (it's on a closed system so there's no user or auth or anything at this point).
I've manually tested getting the response code ...
0
votes
1answer
54 views
Simpletest problems when logging in user - Undefined property: stdClass::$name, stdClass::$pass_raw [closed]
I'm receiving some errors when attempting to login a user with simpletest. I was following the tutorial on DO (SimpleTest Tutorial) and as far as I can tell I've carried out the steps correctly. ...
1
vote
1answer
38 views
drupal 7 entity and simple test
What I can't workout is what steps I need to see if the entity is loaded using simple test. Any direction will be greatly appreciated thanks.
/**
* @file
* Definition of creation of a entity.
*/
...
0
votes
1answer
28 views
testing a function
I have setup a file called mymodule.test and in the module I have file called mymodule.inc.
Every is working but I am unsure about the following. Below is mymodule.test file.
class MyModule extends ...
0
votes
2answers
35 views
Drupal registry table not populated with test class files
I tried to write tests for custom modules and I found that registry database table is not populated with .test files and thus admin/config/development/testing displays only one SimpleTest test. I ...
0
votes
1answer
29 views
Why is my alias “NULL” in a test?
I am using Drupal 7, I have Pathauto enabled, and my user has permissions to create new aliases.
When I manually create a node, uncheck the checkbox for automatic alias generation, and enter a custom ...
2
votes
1answer
29 views
Version numbers of dependencies in testing
If I'm submitting a test to the qa.drupal.org testbot, and my module requires a dev version of another module in order to function properly, is it adequate to declare the version in my module's .info ...
0
votes
1answer
41 views
Creating custom node aliases inside a simpletest
I am attempting to write simpletests to replicate the steps to reproduce on this d.o issue.
I need to create a test node with a custom alias, as if I had unchecked the "Generate automatic URL alias" ...
0
votes
1answer
63 views
Is there a clean-URL-reflective version of file_create_url()?
I have a site with clean URLs enabled and in a test I've written, I compare the current drupalGetHeader('location') to file_create_url($file->uri). The tests passes on my site, but on the ...
0
votes
1answer
29 views
Does DrupalWebTestCase::drupalGet() use the permissions of DrupalWebTestCase::$loggedInUser?
I'm trying to test the permissions of a particular role, and this code:
$this->drupalLogin($this->editor_user);
$this->drupalGet($node->path['source']);
returns a 200 (OK) status, when ...
2
votes
1answer
48 views
Programmatically save altered file
As I mentioned in my previous question I'm attempting to write tests for a patch that will, ideally, trigger the creation of a redirect if the URI of a file changes.
My patch uses hook_file_update() ...
4
votes
1answer
55 views
$file->original: Where does it come from?
I am attempting to write a patch for the Redirect module that automatically creates a redirect from the old file path to the new one, whenever a file is updated.
I added a hook to redirect.module:
...
3
votes
0answers
29 views
Checking if module has the right output on multilingual pages with simpletest_clone
I'm trying with simpletest_clone to check if my modules have the right output depending on the language.
Now my problem is, that when I do the following Code:
$this->drupalGet('de');
// check the ...
0
votes
0answers
61 views
Media module, file usage, and simpletest
I'm trying to write a test that will do the following:
Create a user
Create an 'article' node
Upload a file via Media module
Insert that file into the body via pre-determined markup
Save the node
...
3
votes
0answers
125 views
Why not programatically created nodes in the simpletests?
Most core and many contrib simpletest test create nodes by preparing the interface, logging an admin in and then filling out the form on /node/add/foo. Not only is this terribly slow, it fails at the ...
0
votes
2answers
59 views
How to inspect a variable when testing with `drush test-run`.
When testing with my SimpleTests, I want to inspect a variable. var_dump() and the likes are not being rendered in the output of Drush, Xdebug interactive debugger does not work due to the simulated ...
3
votes
1answer
72 views
Invoking Drupal core tests from within a custom module .test script
I am writing a simpletest test script, where I would like to enable my module, and then invoke a Drupal core test to ensure that my module is producing core-compliant results (in particular, I render ...
0
votes
1answer
63 views
How to check if code is running inside simpletest?
Here's the best I've come up with so far:
/**
* Returns TRUE if our code is running via a simpletest.
*
* We don't check for the database prefix so that this can be used by Unit
* Tests also.
*
...
0
votes
1answer
49 views
Drupal + Simpletest + Class Autoloading = FALSE?
Just a quick question which I couldn't Google : is class autoloading not "enabled" when running tests using SimpleTest?
I'm using the Drupal SimpleTest module, and I'm trying to instantiate a class ...
0
votes
1answer
139 views
How to write test cases for custom ajax functionality using simpletest in drupal7
I am trying to write the test case for my custom ajax functionality in Drupal 7. I am firing the event on click in my .js file but the test case gets a fail.
In my .tpl.php template file I have the ...
2
votes
2answers
209 views
Headless Web Browser During Cron?
I need a headless web browser with JS support to use during cron. It seems like the simpletest module does what I need, but how could one initiate a browser and hand it a DOM?
Outside the context of ...
0
votes
1answer
112 views
I can't enable SimpleTest due to open_basedir restriction being in force
I can't enable SimpleTest due to an open_basedir restriction being in force for my Drupal7 installaton which resides on a Linux server running PHP 5.2.12. I found the directive under my PHP.INI file ...
0
votes
2answers
76 views
How to view simpletest results?
It looks like it's something obvious but I can't find the web interface to view simpletest results. Where should I view the errors besides the DB?
0
votes
2answers
117 views
Why DrupalWebTestCase processing took so long?
I want to create a test that uses the database, so I must use the DrupaWebTestCase class.
I create the following test class with this simple test:
class MyModuleTest extends DrupalWebTestCase {
...
0
votes
1answer
127 views
Create a simpletest test to add additional form elements using the “Add another item” button
I am trying to create a test case for my custom module using simpletest in Drupal7. I want to create a node. The problem is that the node edit form contains a number of fields which can have ...
1
vote
1answer
223 views
SimpleTest clicking one of multiple “Add Another Item” buttons
I'm attempting to test a node's form that has multiple fields that allow arbitrary numbers of entries. As such, there are several "Add Another Item" entries. In the SimpleTest docs (I think, I may ...
0
votes
1answer
273 views
“Failed to set field” Problem with SimpleTest, testing a form
With SimpleTests, I want to test a form similar to :
// Textfield :
$form['fieldset_name']['test'] = array(
'#type' => 'textfield',
...
);
// Submit :
...
2
votes
2answers
274 views
Redirect SimpleTest queries to a different database
How can I tell SimpleTest to use a different database than the default connection? I want to be able to run the tests against an in memory database while keeping the local data on disk.
UPDATE:
So ...
0
votes
1answer
141 views
Is it possible to run functional tests without creating test tables?
My goal is to speed up functional tests without tweaking the database. Is it possible to avoid the creation of Simpletests setup tables and use existing tables instead? I read this article where the ...
0
votes
0answers
127 views
Problem with taxonomy_term_reference field in Simpletest
I create a taxonomy field in module.install and it works as expected:
$field_config = array(
'field_name' => 'field_trainer',
'cardinality' => -1,
'type' => ...
0
votes
1answer
768 views
Can't find file to patch at input line 11, File to patch:?
I got an error message on module installation simpletest
SimpleTest could not be installed. Must apply core patch, please see INSTALL.txt. (Currently using SimpleTest code addition Not-found)
...
0
votes
1answer
54 views
Using custom test helpers in your test cases
I'm trying to write test cases for my custom module and in order to speed things along for current and future testing I defined a garbage class that can spit out random data. However the testing ...
1
vote
1answer
246 views
Using SimpleTest to test an image upload
I have a basic test written (per http://drupal.org/simpletest-tutorial-drupal7) but I am unsure how to proceed to test an image field.
public function testSimpleTestExampleCreate() {
// Create ...
1
vote
1answer
151 views
using DrupalWebTestCase - any trick to prevent it from running from scratch each time?
It makes sense to run each test in a completely clean environment. However, before tests can be run, they have to be developed, during this process it is so frustrating to have to wait 3 or 4 minutes ...
0
votes
1answer
145 views
Simpletest db table cleanup
Everytime I run simpletest it creates tables that it does not clean up. Is there anyway to tell drupal to automatically clean these? I looked in my db today and there are hundred of misc unecessary ...
1
vote
2answers
66 views
How can I prevent or limit CRON during SimpleTest?
I have a CRON job that tops up a huge cache table. Normally, it only updates a few records. But the first time it runs in a new installation, it has to load the entire table with thousands of requests ...
0
votes
1answer
215 views
SimpleTest: How to make multiple Ajax posts and then save the data?
I have a form with AJAX buttons that add items to a list. To SimpleTest the form, I need to make the AJAX post:
$this->drupalPostAJAX(NULL, $edit, array('op' => 'Add Item Button'));
...then ...
0
votes
1answer
148 views
Having trouble POSTing value for a select element with SimpleTest
I am trying to write a SimpleTest for a form that already exists. The form passes tests for GET, valid HTML and having the select element, which looks like this:
<select id="edit-buid" name="buid" ...
