Files
espocrm/tests/Api/SettingsTest.php
2013-11-15 17:36:28 +02:00

49 lines
950 B
PHP

<?php
namespace tests\Api;
require_once('tests/testBootstrap.php');
class SettingsTest extends \PHPUnit_Framework_TestCase
{
protected $fixture;
protected function setUp()
{
require_once('tests/Api/RestTesterClass.php');
$this->fixture = new RestTesterClass();
$this->fixture->setUrl('/settings');
}
protected function tearDown()
{
$this->fixture = NULL;
}
function testGet()
{
$this->fixture->setType('GET');
$this->assertTrue($this->fixture->isSuccess());
}
function testPatch()
{
$this->fixture->setType('PATCH');
$array= array(
"customTest"=> array("test"=> "success"),
);
$json= json_encode($array);
$this->assertTrue( $this->fixture->isSuccess($json) );
//config get if the customTest item exists
$savedValue = $GLOBALS['app']->getContainer()->get('config')->get('customTest');
$this->assertObjectHasAttribute('test', $savedValue);
}
}
?>