public function testNestedCapturingFails() { $this->helper->__invoke()->captureStart(); echo "Captured text"; try { $this->helper->__invoke()->captureStart(); $this->helper->__invoke()->captureEnd(); $this->fail('Nested capturing should fail'); } catch (View\Exception\ExceptionInterface $e) { $this->helper->__invoke()->captureEnd(); $this->assertContains('Cannot nest', $e->getMessage()); } }