Repository: flutter/flutter
File: packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart (Dart)

Code before:
      final command = BuildCommand(
        androidSdk: FakeAndroidSdk(),
        buildSystem: TestBuildSystem.all(BuildResult(success: true)),
        logger: logger,
        fileSystem: fileSystem,
        osUtils: FakeOperatingSystemUtils(),
      );
      fakeProcessManager.addCommands(<FakeCommand>[
        xattrCommand,
        setUpFakeXcodeBuildHandler(),
        exportArchiveCommand(
          exportOptionsPlist: _exportOptionsPlist,
          cachePlist: cachedExportOptionsPlist,
        ),
      ]);
      createMinimalMockProjectFiles();

      await createTestCommandRunner(command).run(const <String>['build', 'ipa', '--no-pub']);

      const expectedIpaPlistContents = '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>method</key>
        <string>app-store-connect</string>
        <key>uploadBitcode</key>
        <false/>
    </dict>
</plist>
''';

      final String actualIpaPlistContents = fileSystem
          .file(cachedExportOptionsPlist)
          .readAsStringSync();
      expect(actualIpaPlistContents, expectedIpaPlistContents);

      expect(logger.statusText, contains('build/ios/archive/Runner.xcarchive'));
      expect(logger.statusText, contains('Building App Store IPA'));
      expect(logger.statusText, contains(RegExp(r'Built IPA to build/ios/ipa \(\d+\.\d+MB\)')));
      expect(logger.statusText, contains('To upload to the App Store'));
      expect(logger.statusText, contains('Apple Transporter macOS app'));
      expect(fakeProcessManager, hasNoRemainingExpectations);
    },
    overrides: <Type, Generator>{
      FileSystem: () => fileSystem,
      Logger: () => logger,
      ProcessManager: () => fakeProcessManager,
      Pub: ThrowingPub.new,
      Platform: () => macosPlatform,
      XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),

Review comment (suggestion):
Can the checks around the version be removed now that the minimum required is 16?

https://github.com/flutter/flutter/blob/a0a27839c6a391b8f81160fba6c3b46b1eb3000a/packages/flutter_tools/lib/src/commands/build_ios.dart#L647-L664

Code after:
          ],
          exitCode: 1,
          stderr: 'error: exportArchive: "Runner.app" requires a provisioning profile.',
        ),
      ]);
      createMinimalMockProjectFiles();

      fileSystem.directory('build/ios/archive/Runner.xcarchive').createSync(recursive: true);

      await createTestCommandRunner(command).run(const <String>['build', 'ipa', '--no-pub']);

      expect(logger.statusText, contains('Built build/ios/archive/Runner.xcarchive'));
      expect(logger.statusText, contains('Building App Store IPA'));
      expect(logger.errorText, contains('Encountered error while creating the IPA:'));
      expect(
        logger.errorText,
        contains('error: exportArchive: "Runner.app" requires a provisioning profile.'),
      );
      expect(logger.errorText, contains('Try distributing the app in Xcode:'));
      expect(logger.errorText, contains('open /build/ios/archive/Runner.xcarchive'));
      expect(fakeProcessManager, hasNoRemainingExpectations);
    },
    overrides: <Type, Generator>{
      FileSystem: () => fileSystem,
      Logger: () => logger,
      ProcessManager: () => fakeProcessManager,
      Pub: ThrowingPub.new,
      Platform: () => macosPlatform,
      XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
      Artifacts: () => Artifacts.test(),
    },
  );

  testUsingContext(
    'ipa build ignores deletion failure if generatedExportPlist does not exist',
    () async {
      final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist');
      final command = BuildCommand(
        androidSdk: FakeAndroidSdk(),
        buildSystem: TestBuildSystem.all(BuildResult(success: true)),
        logger: logger,
        fileSystem: fileSystem,
        osUtils: FakeOperatingSystemUtils(),
      );
      fakeProcessManager.addCommands(<FakeCommand>[
        xattrCommand,
        setUpFakeXcodeBuildHandler(),
        exportArchiveCommand(
          exportOptionsPlist: _exportOptionsPlist,
          cachePlist: cachedExportOptionsPlist,
          deleteExportOptionsPlist: true,