76 lines
2.4 KiB
PHP
76 lines
2.4 KiB
PHP
<?php
|
|
/************************************************************************
|
|
* This file is part of EspoCRM.
|
|
*
|
|
* EspoCRM - Open Source CRM application.
|
|
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
|
* Website: http://www.espocrm.com
|
|
*
|
|
* EspoCRM is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* EspoCRM is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
|
************************************************************************/
|
|
|
|
namespace tests\Espo\Core\Utils;
|
|
|
|
use tests\ReflectionHelper;
|
|
|
|
|
|
class MetadataTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
protected $object;
|
|
|
|
protected $objects;
|
|
|
|
protected $reflection;
|
|
|
|
|
|
protected function setUp()
|
|
{
|
|
$this->objects['config'] = $this->getMockBuilder('\Espo\Core\Utils\Config')->disableOriginalConstructor()->getMock();
|
|
$this->objects['fileManager'] = new \Espo\Core\Utils\File\Manager();
|
|
|
|
//set to use cache
|
|
$this->objects['config']
|
|
->expects($this->any())
|
|
->method('get')
|
|
->will($this->returnValue(true));
|
|
|
|
|
|
$this->object = new \Espo\Core\Utils\Metadata($this->objects['config'], $this->objects['fileManager']);
|
|
|
|
$this->reflection = new ReflectionHelper($this->object);
|
|
$this->reflection->setProperty('cacheFile', 'tests/testData/Utils/Metadata/metadata.php');
|
|
$this->reflection->setProperty('ormCacheFile', 'tests/testData/Utils/Metadata/ormMetadata.php');
|
|
}
|
|
|
|
protected function tearDown()
|
|
{
|
|
$this->object = NULL;
|
|
}
|
|
|
|
|
|
function testGet()
|
|
{
|
|
$result = 'System';
|
|
$this->assertEquals($result, $this->object->get('app.adminPanel.system.label'));
|
|
|
|
$result = 'fields';
|
|
$this->assertArrayHasKey($result, $this->object->get('entityDefs.User'));
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|