public function getData() { if ($this->data !== null) { // Return data if known return $this->data; } if ($this->iconv !== null) { // Calculate with iconv if we know the encoding name $this->data = self::generateEncodingMap($this->iconv); return $this->data; } // Can't encode.. throw new InvalidArgumentException("Cannot encode this code page"); }
public function testDataCannotEncode() { $this->setExpectedException('\\InvalidArgumentException'); $cp = new CodePage("foo", array("name" => "foo")); $this->assertFalse($cp->isEncodable()); $cp->getData(); }