Add ItemValidationByName.
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-08-20 11:14:23 +03:00
parent c9974b007a
commit 8c62393d3f
6 changed files with 97 additions and 48 deletions
-27
View File
@@ -38,31 +38,4 @@ class ItemTest extends TestCase
$this->assertFalse($is_belong);
}
/* Item validation */
public function test_item_with_empty_name(): void
{
$json = Item::validate_with_name('');
$this->assertEquals($json['error'], 'The item name is empty, please, write the name!!!');
}
public function test_not_existing_item_with_name(): void
{
$name = '404 Item';
$json = Item::validate_with_name($name);
$this->assertEquals($json['error'], 'A item with the name does not exist!!!');
}
public function test_valid_item_with_name(): void
{
$name = 'Pizza Polo';
$json = Item::validate_with_name($name);
$this->assertEquals($json['ok'], 'A item with the name is valid.');
}
}