function test_hasValue() { $record = new Dataface_Record('Profiles', array()); $record->setValue('id', 5); $record->setValue('fname', 'tom'); $this->assertTrue($record->hasValue('id')); $this->assertTrue($record->hasValue('fname')); $this->assertTrue(!$record->hasValue('fake')); $record->setValue('id', null); $this->assertTrue($record->hasValue('id')); }
/** * Unit test for http://bugs.weblite.ca/view.php?id=685 */ function testHasValue() { $formula = new Dataface_Record('formulas', array('formula_id' => 10)); $this->assertTrue($formula->hasValue('formula_id'), 'hasValue() failed to identify that the formulas table has a formula_id field'); $this->assertTrue($formula->hasValue('formula_name'), 'hasValue() actually only checks that a field exists in the table. It doesnt say anything about that fields value.'); $this->assertTrue(!$formula->hasValue('nonexistent_field'), 'hasValue() should return false if asked about a field that doesnt exist.'); }