def test_write_method_in_class_with_empty_class(self): self.method_data.class_file_path = self.empty_class_file_path self.method_data.class_name = 'EmptyClass' result = PHPFile.write_method_in_class(self.method_data) content = '' with open(self.empty_class_file_path, 'r') as file_content: content = file_content.read() self.assertTrue(result) self.assertIn('testMethod', content)
def test_write_method_in_class_private_method(self): self.method_data.class_file_path = self.class_file_path self.method_data.method_visibility = 'private' self.method_data.method_name = 'testMethod2' result = PHPFile.write_method_in_class(self.method_data) content = '' with open(self.class_file_path, 'r') as file_content: content = file_content.read() self.assertTrue(result) self.assertIn('private function testMethod2', content)
def test_write_method_in_class_static_method(self): self.method_data.class_file_path = self.class_file_path self.method_data.method_is_static = True self.method_data.method_name = 'testMethod2' result = PHPFile.write_method_in_class(self.method_data) content = '' with open(self.class_file_path, 'r') as file_content: content = file_content.read() self.assertTrue(result) self.assertIn('static function testMethod2', content)
def test_write_method_in_class_without_file(self): self.method_data.class_file_path = self.no_file_path result = PHPFile.write_method_in_class(self.method_data) self.assertFalse(result)