/** * Testing the addProperty() method. * * @since 2.0 */ public function testAddProperty() { $record = new BadRequest(); $record->newStringField = new String(); $record->addProperty('newStringField'); $record->set('newStringField', 'test value'); $record->save(); $record->reload(); $this->assertEquals('test value', $record->get('newStringField'), 'Testing that we can save and retrieve from a newly-added column'); $record = new BadRequest(); $record->setMaintainHistory(true); $record->rebuildTable(); $record->anotherNewStringField = new String(); $record->addProperty('anotherNewStringField'); $record->set('anotherNewStringField', 'test value'); $record->save(); $record->load($record->getOID(), 1); $this->assertEquals('test value', $record->get('anotherNewStringField'), 'Testing that the new column was added to the _history table'); }
/** * Called before the test functions will be executed * this function is defined in PHPUnit_TestCase and overwritten * here. * * @since 1.0 */ protected function setUp() { $config = ConfigProvider::getInstance(); $config->set('session.provider.name', 'Alpha\\Util\\Http\\Session\\SessionProviderArray'); $this->blacklistedClient = new BlacklistedClient(); $this->blacklistedClient->rebuildTable(); $this->blacklistedClient->set('client', $this->badAgent); $this->blacklistedClient->save(); $this->blacklistedIP = new BlacklistedIP(); $this->blacklistedIP->rebuildTable(); $this->blacklistedIP->set('IP', $this->badIP); $this->blacklistedIP->save(); $this->badRequest1 = new BadRequest(); $this->badRequest1->rebuildTable(); $this->badRequest1->set('client', $this->badAgent); $this->badRequest1->set('IP', $this->badIP); $this->badRequest1->set('requestedResource', '/doesNotExist'); $this->badRequest1->save(); $this->badRequest2 = new BadRequest(); $this->badRequest2->set('client', $this->badAgent); $this->badRequest2->set('IP', $this->badIP); $this->badRequest2->set('requestedResource', '/doesNotExist'); $this->badRequest2->save(); $this->badRequest3 = new BadRequest(); $this->badRequest3->set('client', $this->badAgent); $this->badRequest3->set('IP', $this->badIP); $this->badRequest3->set('requestedResource', '/doesNotExist'); $this->badRequest3->save(); }