/** * @brief test the implod method * */ public function testFormatImplodeError() { $this->GoogleStaticChartEngine->setType('line'); //$this->expectError('Value for size is type string and expecting array'); $this->setExpectedException('PHPUnit_Framework_Error'); $this->GoogleStaticChartEngine->_implode('size', 'string'); //$this->expectError('No format available for foo'); $this->setExpectedException('PHPUnit_Framework_Error'); $this->GoogleStaticChartEngine->_implode('foo', array(1, 2, 3)); //$this->expectError('Array to string conversion'); $this->setExpectedException('PHPUnit_Framework_Error'); $this->GoogleStaticChartEngine->_implode('size', array(array(1, 2, 3))); }
/** * @brief test the implod method */ public function testFormatImplode() { $this->GoogleStaticChartEngine->setType('line'); $expected = '1,2,3,4,5'; $this->assertEqual($expected, $this->GoogleStaticChartEngine->_implode('data', array(1, 2, 3, 4, 5))); $expected = '1|2|3|4|5'; $this->assertEqual($expected, $this->GoogleStaticChartEngine->_implode('labels', array(1, 2, 3, 4, 5))); $expected = '1x2x3x4x5'; $this->assertEqual($expected, $this->GoogleStaticChartEngine->_implode('size', array(1, 2, 3, 4, 5))); $this->expectError('Value for size is type string and expecting array'); $this->GoogleStaticChartEngine->_implode('size', 'string'); $this->expectError('No format available for foo'); $this->GoogleStaticChartEngine->_implode('foo', array(1, 2, 3)); $this->expectError('Array to string conversion'); $this->GoogleStaticChartEngine->_implode('size', array(array(1, 2, 3))); }