public function testFields() { $document = new Document(); $document->addField(Document\Field::Text('title', 'Title')); $document->addField(Document\Field::Text('annotation', 'Annotation')); $document->addField(Document\Field::Text('body', 'Document body, document body, document body...')); $fieldnamesDiffArray = array_diff($document->getFieldNames(), array('title', 'annotation', 'body')); $this->assertTrue(is_array($fieldnamesDiffArray)); $this->assertEquals(count($fieldnamesDiffArray), 0); $this->assertEquals($document->title, 'Title'); $this->assertEquals($document->annotation, 'Annotation'); $this->assertEquals($document->body, 'Document body, document body, document body...'); $this->assertEquals($document->getField('title')->value, 'Title'); $this->assertEquals($document->getField('annotation')->value, 'Annotation'); $this->assertEquals($document->getField('body')->value, 'Document body, document body, document body...'); $this->assertEquals($document->getFieldValue('title'), 'Title'); $this->assertEquals($document->getFieldValue('annotation'), 'Annotation'); $this->assertEquals($document->getFieldValue('body'), 'Document body, document body, document body...'); if (PHP_OS == 'AIX') { return; // tests below here not valid on AIX } $wordsWithUmlautsIso88591 = iconv('UTF-8', 'ISO-8859-1', 'Words with umlauts: åãü...'); $document->addField(Document\Field::Text('description', $wordsWithUmlautsIso88591, 'ISO-8859-1')); $this->assertEquals($document->description, $wordsWithUmlautsIso88591); $this->assertEquals($document->getFieldUtf8Value('description'), 'Words with umlauts: åãü...'); }