first commit
This commit is contained in:
58
modules/gamification/tests/unit/AdviceTest.php
Normal file
58
modules/gamification/tests/unit/AdviceTest.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AdviceTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var array the list of expected properties of Advice model
|
||||
*/
|
||||
const ADVICE_PROPERTIES = [
|
||||
'table',
|
||||
'primary',
|
||||
'multilang',
|
||||
'fields',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array the list of fields of Advice model
|
||||
*/
|
||||
const ADVICE_FIELDS = [
|
||||
'id_ps_advice',
|
||||
'id_tab',
|
||||
'selector',
|
||||
'location',
|
||||
'validated',
|
||||
'start_day',
|
||||
'stop_day',
|
||||
'weight',
|
||||
'html',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var Advice
|
||||
*/
|
||||
private $advice;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->advice = new Advice();
|
||||
}
|
||||
|
||||
public function testAdviceDefinitionIsValid()
|
||||
{
|
||||
$definition = Advice::$definition;
|
||||
|
||||
$this->assertInternalType('array', $definition);
|
||||
|
||||
foreach (self::ADVICE_PROPERTIES as $property) {
|
||||
$this->assertArrayHasKey($property, $definition);
|
||||
}
|
||||
|
||||
$fieldsProperty = $definition['fields'];
|
||||
|
||||
foreach (self::ADVICE_FIELDS as $field) {
|
||||
$this->assertArrayHasKey($field, $fieldsProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
modules/gamification/tests/unit/BadgeTest.php
Normal file
21
modules/gamification/tests/unit/BadgeTest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BadgeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Badge
|
||||
*/
|
||||
private $badge;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->badge = new Badge();
|
||||
}
|
||||
|
||||
public function testImgUrl()
|
||||
{
|
||||
$this->assertStringStartsWith(__PS_BASE_URI__, $this->badge->getBadgeImgUrl());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user