/** * Testing that markTransient and markPersistent methods. * * @since 1.0 * @dataProvider getActiveRecordProviders */ public function testMarkTransientPersistent($provider) { $config = ConfigProvider::getInstance(); $config->set('db.provider.name', $provider); // initial save $this->person->save(); // now mark the URL transient, and save again (old URL value should not be overwritten) $this->person->markTransient('URL'); $this->assertTrue(in_array('URL', $this->person->getTransientAttributes()), 'Testing that markTransient and markPersistent methods'); $this->person->set('URL', 'http://www.alphaframework.org/'); $this->person->save(); // used to ensure that we attempt to reload it from the DB $this->person->markPersistent('URL'); $this->assertFalse(in_array('URL', $this->person->getTransientAttributes()), 'Testing that markTransient and markPersistent methods'); // reload from DB $this->person->reload(); $this->assertEquals('http://unitTestUser/', $this->person->get('URL'), 'Testing that markTransient and markPersistent methods'); }