Non-persistent variable_set for testing and hackery

Writing simpletests for imagecache_create_url and file_create_url today, I had to change a few of Drupal's persistent variables, namely clean_url and file_downloads. I was kind of frustrated by the need to save the old values, set the values I needed for the test case, run the test, then restore the old variables.

The process itself is a little dangerous in the case you hit runtime fatal errors and the variables never get restored.. Also during the course of the testing all other requests to the same drupal site are affected by this variable change, so there are potential concurrency errors as well.

I was thinking.. wouldn't it be awesome if I could set variables for just the current request... aka just set $conf['variable_name']...

since there have been movements to eliminate globals and I'm just generally scared of them... and I want non-persistant variable_set I though changing variable_set by adding a persistent argument would make testing a little easier and maybe enable some kinds of strange hacker for others...

<?php
function variable_set($name$value$persistent true) {
  global 
$conf;

  if (
$persistent) {
   
$serialized_value serialize($value);
   
db_query("UPDATE {variable} SET value = '%s' WHERE name = '%s'"$serialized_value$name);
    if (!
db_affected_rows()) {
      @
db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')"$name$serialized_value);
    }
   
cache_clear_all('variables''cache');
  }
 
$conf[$name] = $value;
}
?>

Just an idea since testing seems to be in the air... maybe the problem is already solved elsewhere...

Comments

yep, already there

I believe DrupalTestCase (or some related simpletest class) already provides a non-persistent variable_set(), plus a few other non-persistent setters that are reset when the test is done.

Don't know the name by heart, but I remember webchick's simpletest tutorial to have covered that functionality.

Not a problem in 7.x SimpleTest -> possible backport

The latest version of SimpleTest that was committed to the Drupal core creates a temporary database before each test function and clears it after the test. This alleviates the issue you are having.

I assume you are writing in the 5.x framework. I am not familiar with the installer and if it would be easy to backport this functionality. There are several issues related to back-porting the large number of changes in the 7.x version and I plan to work on them soon so this will definitely be something I will look into.
http://drupal.org/node/241156
http://drupal.org/node/254507

The non-persistent

The non-persistent variable_set works, but it will obviously not revert if the test crashes. That creates problems when writing tests since they inevitably crash while in development. As a temporary solution it works, but I hope to back-port much of the improvements made to 7.x.

dog products

The process itself is a little dangerous in the case you hit runtime fatal errors and the variables never get restored.. Also during the course of the testing all other requests to the same drupal site are affected by this variable change, so there are potential concurrency errors as well.

_____________
dog products

I want non-

I want non-persistant variable_set I though changing variable_set by adding a persistent argument would make testing a little easier and maybe enable some kinds of strange hacker for others

_____________________
Term Paper | Dissertation Writing

Im sure this had been solved

Im sure this had been solved prior to this post

Free iMac

etwetewt

generic cialis
pissing porn
gay porn
hentai porn vids
BUY ACOMPLIA
buy actos
buy adalat
buy advair diskus
buy bactrim
buy abilify
buy aciphex
buy allegra online
buy Altace
buy Amaryl
buy amoxil
buy Arava
buy Asendin online
buy Atarax
buy Avandia
buy avapro
buy Aventyl
buy Cardura
buy casodex
buy Caverta
buy celebrex
buy celexa
buy cialis
buy Cipro
buy Clarinex
buy Claritin
buy Clomid
buy Coreg
buy Coumadin
buy crestor
buy cymbalta
buy Deltasone
buy Depakote
buy Desyrel
buy diflucan
buy Diovan
buy Effexor
buy Elavil
buy Evista
buy Flomax
buy florinef
buy fosamax
buy glucophage
buy Glucotrol
buy Imitrex
buy inderal
buy Isoptin
buy kamagra
buy lamictal
buy lamisil online
buy lasix online
buy Levaquin
buy levitra online
buy lexapro
buy Lioresal
buy Lipitor online
buy lopressor online
buy lotensin online"
buy mevacor online
buy neurontin online"
buy nexium online
buy Nolvadex online"
buy Norvasc online
buy Pamelor online
buy paxil online
buy plavix online
buy pravachol online"
buy premarin online
buy Prevacid online
buy Prilosec online
buy propecia online
buy Protonix online
BUY RETIN-A ONLINE
Buy Risperdal online
Buy rulide online
buy seroquel online
buy Silagra online
Buy Singulair Online
buy soma online
buy strattera online
buy sumycin online
Buy Symmetrel Online
buy synthroid online
buy tamiflu online
buy tenormin online
buy ultram online
buy viagra online
buy Vigora online
buy Vytorin online
buy xenical online
buy Zantac online
buy Zithromax online
buy Zocor online
buy Zovirax online
buy zyban online
buy Zyprexa online
buy zyrtec online
buy Altace
BUY ACOMPLIA ONLINE
buy actos
buy adalat"
buy advair diskus
generic bactrim
buy Altace
buy Amaryl
buy amoxil
buy abilify
buy aciphex
buy allegra online
buy Arava
buy Asendin online
buy Atarax
buy Avandia
buy avapro
buy Aventyl
buy Cardura
buy casodex
buy Caverta
buy celebrex
buy celexa
buy cialis
buy Cipro
buy Clarinex
buy Claritin
buy Clomid
buy Coreg
buy Coumadin
buy crestor
buy cymbalta
buy Deltasone
buy Depakote
buy Desyrel
buy diflucan
buy Diovan
buy Effexor
buy Elavil
buy Evista
buy Flomax
buy florinef
buy fosamax
buy glucophage
buy Glucotrol
buy Imitrex
buy inderal
buy Isoptin
buy kamagra
buy lamictal
buy lamisil online
buy lasix online
buy Levaquin
buy levitra online
buy lexapro
buy Lioresal
buy Lipitor online
buy lopressor online
buy lotensin online"
buy mevacor online
buy neurontin online"
buy nexium online
buy Nolvadex online"
buy Norvasc online
buy Pamelor online
buy paxil online
buy plavix online
buy pravachol online"
buy premarin online
buy Prevacid online
buy Prilosec online
buy propecia online
buy Protonix online
BUY RETIN-A ONLINE
Buy Risperdal online
Buy rulide online
buy seroquel online
buy Silagra online
Buy Singulair Online
buy soma online
buy strattera online
buy sumycin online
Buy Symmetrel Online
buy synthroid online
buy tamiflu online
buy tenormin online
buy ultram online
buy viagra online
buy Vigora online
buy Vytorin online
buy xenical online
buy Zantac online
buy Zithromax online
buy Zocor online
buy Zovirax online
buy zyban online
buy Zyprexa online
buy zyrtec online
BUY ACOMPLIA
BUY ACOMPLIA
BUY ACOMPLIA
buy actos
buy adalat"
buy advair diskus
buy bactrim
buy abilify
buy aciphex
buy allegra online
buy Altace
buy Amaryl
buy amoxil
buy Arava
buy Asendin online
buy Atarax
buy Avandia
buy avapro
buy Aventyl
buy Cardura
buy casodex
buy Caverta
buy celebrex
buy celexa
buy cialis
buy Cipro
buy Clarinex
buy Claritin
buy Clomid
buy Coreg
buy Coumadin
buy crestor
buy cymbalta
buy Deltasone
buy Depakote
buy Desyrel
buy diflucan
buy Diovan
buy Effexor
buy Elavil
buy Evista
buy Flomax
buy florinef
buy fosamax
buy glucophage
buy Glucotrol
buy Imitrex
buy inderal
buy Isoptin
buy kamagra
buy lamictal
buy lamisil online
buy lasix online
buy Levaquin
buy levitra online
buy lexapro
buy Lioresal
buy Lipitor online
buy lopressor online
buy lotensin online"
buy mevacor online
buy neurontin online"
buy nexium online
buy Nolvadex online"
buy Norvasc online
buy Pamelor online
buy paxil online
buy plavix online
buy pravachol online"
buy premarin online
buy Prevacid online
buy Prilosec online
buy propecia online
buy Protonix online
BUY RETIN-A ONLINE
Buy Risperdal online
Buy rulide online
buy seroquel online
buy Silagra online
Buy Singulair Online
buy soma online
buy strattera online
buy sumycin online
Buy Symmetrel Online
buy synthroid online
buy tamiflu online
buy tenormin online
buy ultram online
buy viagra online
buy Vigora online
buy Vytorin online
buy xenical online
buy Zantac online
buy Zithromax online
buy Zocor online
buy Zovirax online
buy zyban online
buy Zyprexa online
buy zyrtec online
BUY ACOMPLIA
BUY ACOMPLIA
buy actos
buy adalat"
buy advair diskus
buy bactrim
buy abilify
buy aciphex
buy allegra online
buy Altace
buy Amaryl
buy amoxil
buy Arava
buy Asendin online
buy Atarax
buy Avandia
buy avapro
buy Aventyl
buy Cardura
buy casodex
buy Caverta
buy celebrex
buy celexa
buy cialis
buy Cipro
buy Clarinex
buy Claritin

tgyeyey

buy Clomid
buy Coreg
buy Coumadin
buy crestor
buy cymbalta
buy Deltasone
buy Depakote
buy Desyrel
buy diflucan
buy Diovan
buy Effexor
buy Elavil
buy Evista
buy Flomax
buy florinef
buy fosamax
buy glucophage
buy Glucotrol
buy Imitrex
buy inderal
buy Isoptin
buy kamagra
buy lamictal
buy lamisil online
buy lasix online
buy Levaquin
buy levitra online
buy lexapro
buy Lioresal
buy Lipitor online
buy lopressor online
buy lotensin online"
buy mevacor online
buy neurontin online"
buy nexium online
buy Nolvadex online"
buy Norvasc online
buy Pamelor online
buy paxil online
buy plavix online
buy pravachol online"
buy premarin online
buy Prevacid online
buy Prilosec online
buy propecia online
buy Protonix online
BUY RETIN-A ONLINE
Buy Risperdal online
Buy rulide online
buy seroquel online
buy Silagra online
Buy Singulair Online
buy soma online
buy strattera online
buy sumycin online
Buy Symmetrel Online
buy synthroid online
buy tamiflu online
buy tenormin online
buy ultram online
buy viagra online
buy Vigora online
buy Vytorin online
buy xenical online
buy Zantac online
buy Zithromax online
buy Zocor online
buy Zovirax online
buy zyban online
buy Zyprexa online
buy zyrtec online
BUY ACOMPLIA
BUY ACOMPLIA
buy actos
buy adalat"
buy advair diskus
buy bactrim
buy abilify
buy aciphex
buy allegra online
buy Altace
buy Amaryl
buy amoxil
buy Arava
buy Asendin online
buy Atarax
buy Avandia
buy avapro
buy Aventyl
buy Cardura
buy casodex
buy Caverta
buy celebrex
buy celexa
buy cialis
buy Cipro
buy Clarinex
buy Claritin
buy Clomid
buy Coreg
buy Coumadin
buy crestor
buy cymbalta
buy Deltasone
buy Depakote
buy Desyrel
buy diflucan
buy Diovan
buy Effexor
buy Elavil
buy Evista
buy Flomax
buy florinef
buy fosamax
buy glucophage
buy Glucotrol
buy Imitrex
buy inderal
buy Isoptin
buy kamagra
buy lamictal
buy lamisil online
buy lasix online
buy Levaquin
buy levitra online
buy lexapro
buy Lioresal
buy Lipitor online
buy lopressor online
buy lotensin online"
buy mevacor online
buy neurontin online"
buy nexium online
buy Nolvadex online"
buy Norvasc online
buy Pamelor online
buy paxil online
buy plavix online
buy pravachol online"
buy premarin online
buy Prevacid online
buy Prilosec online
buy propecia online
buy Protonix online
BUY RETIN-A ONLINE
Buy Risperdal online
Buy rulide online
buy seroquel online
buy Silagra online
Buy Singulair Online
buy soma online
buy strattera online
buy sumycin online
Buy Symmetrel Online
buy synthroid online
buy tamiflu online
buy tenormin online
buy ultram online
buy viagra online
BUY ACOMPLIA
BUY ACOMPLIA
buy actos
buy adalat"
buy advair diskus
buy bactrim
buy abilify
buy aciphex
buy allegra online
buy Altace
buy Amaryl
buy amoxil
buy Arava
buy Asendin online
buy Atarax
buy Avandia
buy avapro
buy Aventyl
buy Cardura
buy casodex
buy Caverta
buy celebrex
buy celexa
buy cialis
buy Cipro
buy Clarinex
buy Claritin
buy Clomid
buy Coreg
buy Coumadin
buy crestor
buy cymbalta
buy Deltasone
buy Depakote
buy Desyrel
buy diflucan
buy Diovan
buy Effexor
buy Elavil
buy Evista
buy Flomax
buy florinef
buy fosamax
buy glucophage
buy Glucotrol
buy Imitrex
buy inderal
buy Isoptin
buy kamagra
buy lamictal
buy lamisil online
buy lasix online
buy Levaquin
buy levitra online
buy lexapro
buy Lioresal
buy Lipitor online
buy lopressor online
buy lotensin online"
buy mevacor online
buy neurontin online"
buy nexium online
buy Nolvadex online"
buy Norvasc online
buy Pamelor online
buy paxil online
buy plavix online
buy pravachol online"
buy premarin online
buy Prevacid online
buy Prilosec online
buy propecia online
buy Protonix online
BUY RETIN-A ONLINE
Buy Risperdal online
Buy rulide online
buy seroquel online
buy Silagra online
Buy Singulair Online
buy soma online
buy strattera online
buy sumycin online
Buy Symmetrel Online
buy synthroid online
buy tamiflu online
buy tenormin online
buy ultram online
buy viagra online
buy Vigora online
buy Vytorin online
buy xenical online
buy Zantac online
buy Zithromax online
buy Zocor online
buy Zovirax online
buy zyban online
buy Zyprexa online
buy zyrtec online
BUY ACOMPLIA
BUY ACOMPLIA
buy actos
buy adalat"
buy advair diskus
buy bactrim
buy abilify
buy aciphex
buy allegra online
buy Altace
buy Amaryl
buy amoxil
buy Arava
buy Asendin online
buy Atarax
buy Avandia
buy avapro
buy Aventyl
buy Cardura
buy casodex
buy Caverta
buy celebrex
buy celexa
buy cialis
buy Cipro
buy Clarinex
buy Claritin
buy Clomid
buy Coreg
buy Coumadin
buy crestor
buy cymbalta
buy Deltasone
buy Depakote
buy Desyrel
buy diflucan
buy Diovan
buy Effexor
buy Elavil
buy Evista
buy Flomax
buy florinef
buy fosamax
buy glucophage
buy Glucotrol
buy Imitrex
buy inderal
buy Isoptin
buy kamagra
buy lamictal
buy lamisil online
buy lasix online
buy Levaquin
buy levitra online
buy lexapro
buy Lioresal
buy Lipitor online
buy lopressor online
buy lotensin online"
buy mevacor online
buy neurontin online"
buy nexium online
buy Nolvadex online"
buy Norvasc online
buy Pamelor online
buy paxil online
buy plavix online
buy pravachol online"
buy premarin online
buy Prevacid online
buy Prilosec online
buy propecia online
buy Protonix online
BUY RETIN-A ONLINE
Buy Risperdal online
Buy rulide online
buy seroquel online
buy Silagra online
Buy Singulair Online
buy soma online
buy strattera online
buy sumycin online
Buy Symmetrel Online
buy synthroid online
buy tamiflu online
buy tenormin online
buy ultram online
buy viagra online
buy Vigora online
buy Vytorin online
buy xenical online
buy Zantac online
buy Zithromax online
buy Zocor online
buy Zovirax online
buy zyban online
buy Zyprexa online
buy zyrtec online

Designer handbags and

Designer handbags and wallets from Gucci
Cheap Gucci Handbag
Gucci Handbag
Gucci Bags
Gucci Wallet
Gucci was founded by Guccio Gucci in Florence, Italy in 1921, and began its life as a family owned leather goods, handbag and saddle store. However, Guccio Gucci had travelled to Europe and London when young, and gained an understanding of Cosmopolitan Culture.Gucci make prestigious luxury products, including bag
Gucci Classics handbag
Gucci Cruise handbag
Gucci Fall Winter handbag