コード例 #1
0
ファイル: tests_PHPFile.py プロジェクト: Sylvaner/extra-tools
 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)
コード例 #2
0
ファイル: tests_PHPFile.py プロジェクト: Sylvaner/extra-tools
 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)
コード例 #3
0
ファイル: tests_PHPFile.py プロジェクト: Sylvaner/extra-tools
 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)
コード例 #4
0
ファイル: tests_PHPFile.py プロジェクト: Sylvaner/extra-tools
 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)