X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fconsolidation%2Foutput-formatters%2Ftests%2FtestIncompatibleData.php;fp=vendor%2Fconsolidation%2Foutput-formatters%2Ftests%2FtestIncompatibleData.php;h=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=d38f96200dc2f957ad46334263202d00b268c123;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/vendor/consolidation/output-formatters/tests/testIncompatibleData.php b/vendor/consolidation/output-formatters/tests/testIncompatibleData.php deleted file mode 100644 index d38f96200..000000000 --- a/vendor/consolidation/output-formatters/tests/testIncompatibleData.php +++ /dev/null @@ -1,64 +0,0 @@ -formatterManager = new FormatterManager(); - } - - protected function assertIncompatibleDataMessage($expected, $formatter, $data) - { - $e = new IncompatibleDataException($formatter, $data, $formatter->validDataTypes()); - $this->assertEquals($expected, $e->getMessage()); - } - - public function testIncompatibleData() - { - $tableFormatter = $this->formatterManager->getFormatter('table'); - - $this->assertIncompatibleDataMessage('Data provided to Consolidation\OutputFormatters\Formatters\TableFormatter must be either an instance of Consolidation\OutputFormatters\StructuredData\RowsOfFields or an instance of Consolidation\OutputFormatters\StructuredData\PropertyList. Instead, a string was provided.', $tableFormatter, 'a string'); - $this->assertIncompatibleDataMessage('Data provided to Consolidation\OutputFormatters\Formatters\TableFormatter must be either an instance of Consolidation\OutputFormatters\StructuredData\RowsOfFields or an instance of Consolidation\OutputFormatters\StructuredData\PropertyList. Instead, an instance of Consolidation\OutputFormatters\FormatterManager was provided.', $tableFormatter, $this->formatterManager); - $this->assertIncompatibleDataMessage('Data provided to Consolidation\OutputFormatters\Formatters\TableFormatter must be either an instance of Consolidation\OutputFormatters\StructuredData\RowsOfFields or an instance of Consolidation\OutputFormatters\StructuredData\PropertyList. Instead, an array was provided.', $tableFormatter, []); - $this->assertIncompatibleDataMessage('Data provided to Consolidation\OutputFormatters\Formatters\TableFormatter must be either an instance of Consolidation\OutputFormatters\StructuredData\RowsOfFields or an instance of Consolidation\OutputFormatters\StructuredData\PropertyList. Instead, an instance of Consolidation\OutputFormatters\StructuredData\PropertyList was provided.', $tableFormatter, new PropertyList([])); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Undescribable data error: NULL - */ - public function testUndescribableData() - { - $tableFormatter = $this->formatterManager->getFormatter('table'); - $data = $tableFormatter->validate(null); - $this->assertEquals('Will throw before comparing.', $data); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Data provided to Consolidation\OutputFormatters\Formatters\TableFormatter must be either an instance of Consolidation\OutputFormatters\StructuredData\RowsOfFields or an instance of Consolidation\OutputFormatters\StructuredData\PropertyList. Instead, a string was provided. - */ - public function testInvalidTableData() - { - $tableFormatter = $this->formatterManager->getFormatter('table'); - $data = $tableFormatter->validate('bad data type'); - $this->assertEquals('Will throw before comparing.', $data); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Data provided to Consolidation\OutputFormatters\Formatters\SectionsFormatter must be an instance of Consolidation\OutputFormatters\StructuredData\RowsOfFields. Instead, a string was provided. - */ - public function testInvalidSectionsData() - { - $tableFormatter = $this->formatterManager->getFormatter('sections'); - $data = $tableFormatter->validate('bad data type'); - $this->assertEquals('Will throw before comparing.', $data); - } -}