예제 #1
0
파일: TypeTest.php 프로젝트: ro-ka/Elastica
    /**
     * Test Delete of index type.  After delete will check for type mapping.
     */
    public function testDeleteType()
    {
        $index = $this->_createIndex();
        $type = new Elastica_Type($index, 'test');
        $type->addDocument(new Elastica_Document(1, array('name' => 'ruflin nicolas')));
        $type->addDocument(new Elastica_Document(2, array('name' => 'ruflin')));
        $index->refresh();

        $type->delete();
        try {
            $type->getMapping();
        }
        catch (Elastica_Exception_Response $expected) {
            $this->assertEquals("TypeMissingException[[elastica_test] type[test] missing]", $expected->getMessage());
            return;
        }

        $this->fail('Mapping for type[test] in [elastica_test] still exists');
    }