Preheat the oven to 170°C, 325°F, gas 3. Heat the oil in a casserole then add the onion and thyme. Cook gently until golden and soft – about 20 minutes – stirring every now and then. Add the garlic and cook for a few minutes until softened. Add the tomatoes and beans and enough water to cover, then season and bring to the boil. Cover with a lid and cook in the oven for around 30 minutes until all is soft. If necessary, remove the lid for the last five minutes to allow some water to evaporate. Sprinkle with chopped basil before serving.