public function testCount() { $this->assertSame(0, $this->_type->count()); $this->_type->createEntry('foo'); $this->_type->createEntry('foo bar'); $this->assertSame(2, $this->_type->count()); }
public function testUpdateItemWithJob() { $query = new CM_Elasticsearch_Query(); $query->queryMatchMulti(array('name'), 'foo'); $source = new CM_PagingSource_Elasticsearch($this->_type, $query); $this->assertSame(0, $source->getCount()); $id1 = $this->_type->createEntry('foo'); $id2 = $this->_type->createEntry('foo bar'); $this->assertSame(2, $source->getCount()); $this->assertEquals(array($id1, $id2), $source->getItems()); CM_Db_Db::update('index_mock', array('name' => 'bar'), array('id' => $id2)); $this->_type->updateItemWithJob(array('id' => $id2)); $this->assertSame(1, $source->getCount()); $this->assertEquals(array($id1), $source->getItems()); }