Пример #1
0
assert('$data["bar"] === "bar_value"');
assert('$data["bar"] !== "wrong"');
assert('$data["baz"] === "baz_value_default"');
assert('$data["baz"] !== "baz_value"');
$data = $test->to_array(false);
assert('count($data) === 2');
assert('$data["bar"] === "bar_value"');
assert('$data["bar"] !== "wrong"');
assert('$data["foo"] !== "foo_value"');
assert('$data["foo"] === "bla"');
/* Test delete() */
$testdelete = new Container();
assert('!$testdelete->is_set("bla")');
$testdelete->set('bla', 'woeiwoei');
assert('$testdelete->is_set("bla")');
$testdelete->delete('bla');
assert('!$testdelete->is_set("bla")');
/* Test underscores and dashes juggling */
$c = new Container();
$c->set('foo_bar', 'baz');
assert('$c->get("foo-bar") === "baz"');
assert('$c->get("foo_bar") === "baz"');
$c->set('foo-bar', 'baz2');
assert('$c->get("foo-bar") === "baz2"');
assert('$c->get("foo_bar") === "baz2"');
$c->add('some-list', 'value');
$c->add('some_list', 'value');
assert('count($c->get("some-list")) === 2');
/* Test getdefault() and setdefault() */
$c = new Container();
assert('$c->getdefault("foo", "defaultvalue") === "defaultvalue"');
Пример #2
0
 public function unqueueCron(Container $cron)
 {
     $cron->delete();
     return $this;
 }
Пример #3
0
 /**
  * @inheritDoc
  */
 public function delete($key)
 {
     $this->items->delete($key);
 }
 /**
  * Not defensively programmed. Shouldn't work on GET and should ask user to confirm they
  * want to delete. Hey Ho, time's pressing.
  *
  */
 function delete()
 {
     $c = new Container($this->uri->segment(3, $_POST['container']));
     $c->delete();
     url::redirect('containers_admin');
 }