Well, that's an interesting question.
We are right now in the middle of a closely analogous case: The president ordered a moratorium on immigration from certain countries, and a federal court ruled that this was "unconstitutional". I say this is analogous because it involves a matter of foreign policy that, until 2017, would routinely have been considered at the discretion of the president and not subject to judicial review.
Last I heard the president obeyed the court order and appealed to the Supreme Court, which has not yet ruled. The fact that the president obeyed the court rather than declaring they had no jurisdiction and ignoring them sets a precedent that the courts do indeed have authority to intervene in foreign policy.
So what would happen in your hypothetical situation if someone sued the president, and the courts ruled against the president? It's hard to say, and it would probably depend a lot on the details of the political situation at the time. It would almost certainly create a constitutional crisis, the question is just where things would end up. If the president announced that the court had no authority to declare war -- and this is effectively what they would be doing -- and if a majority in Congress agreed with the president, that might be the end of it. The president ignores the court, and ... nothing happens. The courts could order that the president be arrested for contempt of court. That would surely precipitate a major crisis. Would federal marshals really try to arrest the president? Would the secret service just stand by and watch as federal marshals entered the White House and arrested the president? Would there be a shoot-out between federal marshals and the secret service? The courts could order the military to go to war, but would judges then expect to direct the war from the Supreme Court building? Would the judges debate strategy, order specific targets for bombing, etc? I guess that's not quite as bizarre as it sounds: judges have taken over school districts and city governments and made administrative decisions from the court room. But going to war would be a pretty extreme case.
If Congress wanted to go to war, this would presumably be a pretext to impeach the president. It would be politically much harder for the president to try to ignore an impeachment. That's very clearly within Congress's constitutional authority.
What if the president said, "Ok, you win, we'll go to war", but then he took no steps to actually do it? He could surely stall for a while saying that we are making war plans, mobilizing the troops, stockpiling weapons, etc. At what point would the court say, "Hey, you're just stalling. Go to war NOW"? And then we're back to the, what are they going to do about it? scenario.