def test_php_proto_rename(): path = 'test/tasks/data/test_protoc/php_rename_task' with open(os.path.join(path, 'ExampleGrpcClientExpected.php')) as exp_file: expected = exp_file.read() with open(os.path.join(path, 'ExampleGrpcClientInitial.php')) as init_file: initial = init_file.read() assert protoc_utils.php_proto_rename(initial) == expected
def execute(self, grpc_code_dir): for filename in protoc_utils.list_files_recursive(grpc_code_dir): if filename.endswith('GrpcClient.php'): logger.info('Performing replacements in: %s' % (filename,)) with io.open(filename, encoding='UTF-8') as f: contents = f.read() contents = protoc_utils.php_proto_rename(contents) with io.open(filename, 'w', encoding='UTF-8') as f: f.write(contents)
def execute(self, grpc_code_dir): for filename in protoc_utils.list_files_recursive(grpc_code_dir): if filename.endswith('GrpcClient.php'): logger.info('Performing replacements in: %s' % (filename, )) with io.open(filename, encoding='UTF-8') as f: contents = f.read() contents = protoc_utils.php_proto_rename(contents) with io.open(filename, 'w', encoding='UTF-8') as f: f.write(contents)