/** * Tests the save method */ public function testSave() { $connection = new ASolrConnection(); $connection->clientOptions->hostname = SOLR_HOSTNAME; $connection->clientOptions->port = SOLR_PORT; $connection->clientOptions->path = SOLR_PATH; ASolrDocument::$solr = $connection; foreach ($this->fixtureData() as $attributes) { $doc = new ASolrDocument(); $doc->setAttributes($attributes); // should fail because of massive assignment on unsafe attributes $this->assertEquals(array(), $doc->getAttributes()); $doc->setAttributes($attributes, false); $this->assertEquals(4, count($doc->getAttributes())); $this->assertTrue($doc->save()); } $connection->commit(); }
/** * Sets up the environment for this test */ public function setUp() { $this->getConnection(); foreach ($this->fixtureData() as $attributes) { $doc = new ASolrDocument(); $doc->setAttributes($attributes, false); $this->assertTrue($doc->save()); } $this->getConnection()->commit(); }