Skip to content

Commit

Permalink
add tests and disable them until 3.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteemann committed Jun 9, 2021
1 parent 35bd88a commit 9f061fd
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions tests/AnalyzerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,69 @@ public function testCreateTextAnalyzerFail()
}
static::assertEquals(400, $exception->getCode());
}

/**
* Test creation of stopwords analyzer
*/
/* disabled until 3.8.1
public function testCreateStopwordsAnalyzer()
{
$analyzer = new Analyzer('Analyzer1' . '_' . static::$testsTimestamp, 'stopwords', [ "stopwords" => ["foo", "bar", "baz", "dead"] ]);
$result = $this->analyzerHandler->create($analyzer);
static::assertEquals('Analyzer1' . '_' . static::$testsTimestamp, $result['name']);
static::assertEquals('stopwords', $result['type']);
static::assertEquals([ "stopwords" => ["foo", "bar", "baz", "dead"] ],$analyzer->getProperties());
static::assertEquals([], $analyzer->getFeatures());
}
*/

/**
* Test creation of delimiter analyzer
*/
public function testCreateDelimiterAnalyzer()
{
$analyzer = new Analyzer('Analyzer1' . '_' . static::$testsTimestamp, 'delimiter', [ "delimiter" => " " ]);
$result = $this->analyzerHandler->create($analyzer);
static::assertEquals('Analyzer1' . '_' . static::$testsTimestamp, $result['name']);
static::assertEquals('delimiter', $result['type']);
static::assertEquals([ "delimiter" => " " ],$analyzer->getProperties());
static::assertEquals([], $analyzer->getFeatures());
}

/**
* Test creation of norm analyzer
*/
public function testCreateNormAnalyzer()
{
$analyzer = new Analyzer('Analyzer1' . '_' . static::$testsTimestamp, 'norm', [ "locale" => "en.UTF-8", "accent" => false, "case" => "lower" ]);
$result = $this->analyzerHandler->create($analyzer);
static::assertEquals('Analyzer1' . '_' . static::$testsTimestamp, $result['name']);
static::assertEquals('norm', $result['type']);
static::assertEquals([ "locale" => "en.UTF-8", "accent" => false, "case" => "lower" ],$analyzer->getProperties());
static::assertEquals([], $analyzer->getFeatures());
}

/**
* Test creation of pipeline analyzer
*/
/* disabled until 3.8.1
public function testCreatePipelineAnalyzer()
{
$data = [ "pipeline" => [
[ "type" => "delimiter", "properties" => [ "delimiter" => " " ] ],
[ "type" => "norm", "properties" => [ "locale" => "en.UTF-8", "accent" => false, "case" => "lower" ] ],
[ "type" => "stopwords", "properties" => [ "stopwords" => ["foo", "bar", "baz", "dead"] ] ]
] ];
$analyzer = new Analyzer('Analyzer1' . '_' . static::$testsTimestamp, 'pipeline', $data);
$result = $this->analyzerHandler->create($analyzer);
static::assertEquals('Analyzer1' . '_' . static::$testsTimestamp, $result['name']);
static::assertEquals('pipeline', $result['type']);
static::assertEquals($data, $analyzer->getProperties());
static::assertEquals([], $analyzer->getFeatures());
}
*/

/**
* Test getting an analyzer
Expand Down

0 comments on commit 9f061fd

Please sign in to comment.