Boilerplate to use a Directus Instance to Build a Custom Website, Content will be Manage by Directus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

5 years ago
  1. <?php
  2. /**
  3. * Flight: An extensible micro-framework.
  4. *
  5. * @copyright Copyright (c) 2012, Mike Cao <mike@mikecao.com>
  6. * @license MIT, http://flightphp.com/license
  7. */
  8. require_once 'vendor/autoload.php';
  9. require_once __DIR__.'/../flight/autoload.php';
  10. class VariableTest extends PHPUnit_Framework_TestCase
  11. {
  12. /**
  13. * @var \flight\Engine
  14. */
  15. private $app;
  16. function setUp() {
  17. $this->app = new \flight\Engine();
  18. }
  19. // Set and get a variable
  20. function testSetAndGet() {
  21. $this->app->set('a', 1);
  22. $var = $this->app->get('a');
  23. $this->assertEquals(1, $var);
  24. }
  25. // Clear a specific variable
  26. function testClear() {
  27. $this->app->set('b', 1);
  28. $this->app->clear('b');
  29. $var = $this->app->get('b');
  30. $this->assertEquals(null, $var);
  31. }
  32. // Clear all variables
  33. function testClearAll() {
  34. $this->app->set('c', 1);
  35. $this->app->clear();
  36. $var = $this->app->get('c');
  37. $this->assertEquals(null, $var);
  38. }
  39. // Check if a variable exists
  40. function testHas() {
  41. $this->app->set('d', 1);
  42. $this->assertTrue($this->app->has('d'));
  43. }
  44. }