/** * Gets a message explaining how many iterations failed in the last query * and why. * * @return string */ public function getFailedIterationsMessage() { if ($this->_failedIterations) { return \PFXUtils::quantify(count($this->_failedIterations), 'iteration') . ' failed . Failed iterations were ' . \PFXUtils::implodeSemantically(', ', $this->_failedIterations) . '.'; } }
/** * Tests PFXUtils::implodeSemantically(). */ public function testImplodeSemantically() { $this->assertEquals('foo and bar', PFXUtils::implodeSemantically(', ', array('foo', 'bar'))); $this->assertEquals('foo, bar, and baz', PFXUtils::implodeSemantically(', ', array('foo', 'bar', 'baz'))); $this->assertEquals('foo; bar; or baz', PFXUtils::implodeSemantically('; ', array('foo', 'bar', 'baz'), 'or')); $this->assertEquals('1, 2, 3, 4, 5, 6, 7, 8, aaaaaaaaand 9', PFXUtils::implodeSemantically(', ', array(1, 2, 3, 4, 5, 6, 7, 8, 9), 'aaaaaaaaand')); $this->assertEquals('1 aaaaaaaaand 9', PFXUtils::implodeSemantically('+', array(1, 9), 'aaaaaaaaand')); }