public function testMapEntity_DocumentShouldContainThreeFields() { $command = new MapAllFieldsCommand(); $actual = $command->createDocument(MetaTestInformationFactory::getMetaInformation()); $this->assertTrue($actual instanceof \SolrInputDocument, 'is a SolrInputDocument'); $this->assertFieldCount(3, $actual, 'three fields are mapped'); $this->assertEquals(1, $actual->getBoost(), 'document boost should be 1'); $boostTitleField = $actual->getField('title_s')->boost; $this->assertEquals(1.8, $boostTitleField, 'boost value of field title_s should be 1.8'); $this->assertHasDocumentFields($actual, self::$MAPPED_FIELDS); }
/** * @test */ public function callGetterWithParameters() { $command = new MapAllFieldsCommand(new MetaInformationFactory($this->reader)); $entity1 = new ValidTestEntity(); $metaInformation = MetaTestInformationFactory::getMetaInformation($entity1); $metaInformation->setFields(array(new Field(array('name' => 'test_field', 'type' => 'datetime', 'boost' => '1', 'value' => new TestObject(), 'getter' => "testGetter('string3', 'string1', 'string')")))); $fields = $metaInformation->getFields(); $metaInformation->setFields($fields); $actual = $command->createDocument($metaInformation); $fields = $actual->getFields(); $this->assertArrayHasKey('test_field_dt', $fields); $this->assertEquals(array('string3', 'string1', 'string'), $fields['test_field_dt']); }