cachedEmployeeVardefs = file_get_contents('cache/modules/Employees/Employeevardefs.php'); unlink('cache/modules/Employees/Employeevardefs.php'); } } public function tearDown() { if(!empty($this->cachedEmployeeVardefs)) { file_put_contents('cache/modules/Employees/Employeevardefs.php', $this->cachedEmployeeVardefs); } } public function testSaveUsersVardefs() { global $dictionary; $dynamicField = new DynamicField('Users'); VardefManager::loadVardef('Users', 'User'); $dynamicField->saveToVardef('Users', $dictionary['User']['fields']); //Test that we have refreshed the Employees vardef $this->assertTrue(file_exists('cache/modules/Employees/Employeevardefs.php'), 'cache/modules/Employees/Emloyeevardefs.php file not created'); //Test that status is not set to be required $this->assertFalse($dictionary['Employee']['fields']['status']['required'], 'status field set to required'); //Test that the studio attribute is set to false for status field $this->assertFalse($dictionary['Employee']['fields']['status']['studio'], 'status field studio not set to false'); } }