Skip to content

Commit

Permalink
Fix unittests
Browse files Browse the repository at this point in the history
umutphp committed Jun 17, 2021

Verified

This commit was signed with the committer’s verified signature.
rm3l Armel Soro
1 parent c443526 commit 0888177
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tests/SimilarityScoreTest.php
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ public function testScoreWithSameModels()
{
$config = [];
$config['similarity_feature_attributes'] = ['type', 'material'];
$config['similarity_taxonomy_attributes'] = ['tag' => '', 'category' => ''];
$config['similarity_taxonomy_attributes'] = [['tag' => ''], ['category' => '']];
$config['similarity_numeric_value_attributes'] = ['price'];

$model1 = new class {
@@ -32,15 +32,15 @@ public function toArray() {

$output = self::calculateSimilarityScore($model1, $model1, $config);

$this->assertTrue($output == 1);
$this->assertTrue($output == 100);
}

/** @test */
public function testScoreWithModelsWithDifferentTag()
{
$config = [];
$config['similarity_feature_attributes'] = ['type', 'material'];
$config['similarity_taxonomy_attributes'] = ['tag' => '', 'category' => ''];
$config['similarity_taxonomy_attributes'] = [['tag' => ''], ['category' => '']];
$config['similarity_numeric_value_attributes'] = ['price'];

$model1 = new class {
@@ -79,7 +79,7 @@ public function testScoreWithModelsWithDifferentWeights()
{
$config = [];
$config['similarity_feature_attributes'] = ['type', 'material'];
$config['similarity_taxonomy_attributes'] = ['tag' => '', 'category' => ''];
$config['similarity_taxonomy_attributes'] = [['tag' => '', 'category' => '']];
$config['similarity_numeric_value_attributes'] = ['price'];

$model1 = new class {
6 changes: 3 additions & 3 deletions tests/TaxonomyTest.php
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ public function testGenerateTaxonomiesWithSimpleFields()
'category' => 'shoe'
];

$taxonomyFields = ['tag' => '', 'category' => ''];
$taxonomyFields = [['tag' => ''], ['category' => '']];

$output = self::generateTaxonomies($model, $taxonomyFields);

@@ -33,7 +33,7 @@ public function testGenerateTaxonomiesWithObjectFields()
'category' => (object) ['name' => 'shoe']
];

$taxonomyFields = ['tag' => 'title', 'category' => 'name'];
$taxonomyFields = [['tag' => 'title'], ['category' => 'name']];

$output = self::generateTaxonomies($model, $taxonomyFields);

@@ -51,7 +51,7 @@ public function testGenerateTaxonomiesWithCollectionFields()
'categories' => $categories
];

$taxonomyFields = ['tags' => 'title', 'categories' => 'name'];
$taxonomyFields = [['tags' => 'title'], ['categories' => 'name']];

$output = self::generateTaxonomies($model, $taxonomyFields);

0 comments on commit 0888177

Please sign in to comment.