public function testConstructorAndGetters()
 {
     $type = 'testtype';
     $options = array('key' => 'value');
     $query = new Query();
     $query->setQuery('test123');
     $event = new PostCreateQuery($type, $options, $query);
     $this->assertEquals($type, $event->getQueryType());
     $this->assertEquals($options, $event->getOptions());
     $this->assertEquals($query, $event->getQuery());
 }
Exemplo n.º 2
0
 public function testCreateQueryPostPlugin()
 {
     $type = Client::QUERY_SELECT;
     $options = array('optionA' => 1, 'optionB' => 2);
     $query = $this->client->createQuery($type, $options);
     $expectedEvent = new PostCreateQueryEvent($type, $options, $query);
     $expectedEvent->setDispatcher($this->client->getEventDispatcher());
     $expectedEvent->setName(Events::POST_CREATE_QUERY);
     $observer = $this->getMock('Solarium\\Core\\Plugin\\Plugin', array('postCreateQuery'));
     $observer->expects($this->once())->method('postCreateQuery')->with($this->equalTo($expectedEvent));
     $this->client->getEventDispatcher()->addListener(Events::POST_CREATE_QUERY, array($observer, 'postCreateQuery'));
     $this->client->createQuery($type, $options);
 }