UnitTest.php in TacJS 8
File
tests/src/Unit/UnitTest.php
View source
<?php
namespace Drupal\tacjs;
use Drupal\Tests\UnitTestCase;
use Drupal\tacjs\TacjsSettings;
use Drupal\tacjs\Unit;
class UnitTest extends UnitTestCase {
protected $unit;
protected $fixture;
public function setUp() {
$this->unit = new TacjsSettings();
$this->fixture = new Unit();
}
public function testGetFields() {
$values = [
"purechat" => "purechat",
];
$data = TacjsSettings::SUPPORT;
$result = [
0 => [
"value" => "purechat",
"name" => "Purechat",
],
];
$this
->assertEquals($result, $this->fixture
->getFields($values, $data));
}
public function testSerializeValuesForm() {
$values = [
"type_social_networks" => [
"facebook" => "facebook",
],
"submit" => [],
"form_build_id" => "",
"form_token" => "",
"form_id" => "",
"op" => [],
];
$result = [
"type_social_networks" => [
"facebook" => "facebook",
],
];
$result = serialize($result);
$this
->assertEquals($result, $this->unit
->serializeValuesForm($values));
}
public function tearDown() {
unset($this->unit);
}
}
Classes
Name |
Description |
UnitTest |
Simple test to ensure that asserts pass. |