Heat the olive oil in a large saucepan over medium heat.
Add the onion, garlic, celery, and carrots, and cook until softened.
Stir in the courgette, chopped tomatoes, tomato purée, oregano, and bay leaf.
Pour in the stock and bring to a gentle boil.
Reduce the heat and simmer for 10 minutes.
Add the cannellini beans and green beans, then simmer for another 10 minutes.
Stir in the pasta and cook until tender.
Add the shredded cabbage or spinach during the final few minutes of cooking.
Remove the bay leaf and stir in the fresh basil.
Season with salt and black pepper.
Serve hot with grated Parmesan, a drizzle of olive oil, and crusty bread.