public function testCanUnsetAVariable() { $this->namespace->testUnset = 5; $this->assertEquals(5, $this->storage->get('testUnset')); $this->storage->remove('testUnset'); $this->assertFalse(isset($this->namespace->testUnset)); $this->assertFalse($this->storage->has('testUnset')); }
/** * validate * * Run validation process * * @return null */ public function validate() { parent::validate(); // compare protection code if (property_exists($this->_data, 'protection_code')) { $protectionCode = \Storage::read('protection-code-register'); \Storage::remove('protection-code-register'); if ($this->_data->protection_code !== $protectionCode) { $this->addMessage('protection_code', \View::$language->register_form_protection_code_invalid); } } // compare password confirmation if (property_exists($this->_data, 'password') && property_exists($this->_data, 'confirm_password') && $this->_data->password !== $this->_data->confirm_password) { $this->addMessage('confirm_password', \View::$language->register_form_password_confirm_mismatch); } // check for existence if ($this->isValid()) { $checkedFields = array('email', 'login'); $UserModel = \App::getInstance('common\\UserModel'); foreach ($checkedFields as $fName) { if ($UserModel->isExists($fName, $this->_data->{$fName})) { $mKey = 'register_form_' . $fName . '_is_exists'; $this->addMessage($fName, \View::$language->{$mKey}); } } } }
/** * Base testing */ public function testBase() { $storage = new Storage(); $alphabet = new Alphabet('en', array(), array(), array()); $storage->add($alphabet); $this->assertEquals($alphabet, $storage->get('en')); $this->assertEquals(array('en' => $alphabet), $storage->all()); $storage->remove($alphabet); $this->assertNull($storage->get('en')); }
/** * rollback */ public function rollback() { $this->storage->remove($this->uri, $this->options); if (is_null($this->previous)) { $this->storage->remove($this->uri); } else { $this->storage->put($this->previous, $this->uri, $this->options); } $this->clean(); $this->initialize(); }
/** * @covers mychaelstyle\Storage::remove * @covers mychaelstyle\Storage::get * @covers mychaelstyle\Storage::put * @depends testGet */ public function testRemove() { $def1 = $this->dsnMap['Local']; $def2 = $this->dsnMap['Local2']; $this->object->addProvider($def2['dsn'], $def2['options']); // remove file $this->object->remove($this->uri_example); // assertLocalDeleted $this->assertLocalDeleted($def1['dsn'], $this->uri_example); $this->assertLocalDeleted($def2['dsn'], $this->uri_example); }
/** * validate * * Run validation process * * @return null */ public function validate() { parent::validate(); // compare protection code if (property_exists($this->_data, 'protection_code')) { $protectionCode = \Storage::read('protection-code-sign-in'); \Storage::remove('protection-code-sign-in'); if ($this->_data->protection_code !== $protectionCode) { $this->addMessage('protection_code', \View::$language->sign_in_form_protection_code_invalid); } } // remove sign in counter data if ($this->isValid()) { \Storage::remove('sign-in-tries'); } }
protected function tearDown() { $this->storage->remove(); }