sikofitt / mocks-drupal-variables
Mock for drupal variable functions variable_(set,get,del)
Installs: 8 234
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.3
Requires (Dev)
This package is auto-updated.
Last update: 2024-03-21 06:06:31 UTC
README
Mocks for drupal variable functions variable_(set,get,del) for testing outside of Drupal
Versions
Drupal 7.x
Usage
composer require sikofitt/mocks-drupal-variables
require 'vendor/autoload.php'
Then just use as if you were in drupal.
variable_set('myvar', 'myvalue'); variable_get('myvar'); // myvalue variable_del('myvar'); variable_get('myvar', 'default_if_not_found'); // default_if_not_found
Just like drupal, every function returns null, except variable_get. But variable_get will return null if the value is not found and no default was given.
Requirements
PHP >=5.3
Tests
phpunit