diff --git a/tests/Espo/Core/Utils/FieldManagerTest.php b/tests/Espo/Core/Utils/FieldManagerTest.php index 5a359825d1..c5667a1564 100644 --- a/tests/Espo/Core/Utils/FieldManagerTest.php +++ b/tests/Espo/Core/Utils/FieldManagerTest.php @@ -30,7 +30,7 @@ class FieldManagerTest extends \PHPUnit_Framework_TestCase public function testCreateExistingField() { - $this->setExpectedException('\Espo\Core\Exceptions\Error'); + $this->setExpectedException('\Espo\Core\Exceptions\Conflict'); $data = array( "type" => "varchar", diff --git a/tests/Espo/Core/Utils/LayoutTest.php b/tests/Espo/Core/Utils/LayoutTest.php index 1dafa56cc7..713d9b4e24 100644 --- a/tests/Espo/Core/Utils/LayoutTest.php +++ b/tests/Espo/Core/Utils/LayoutTest.php @@ -8,7 +8,7 @@ use tests\ReflectionHelper; class LayoutTest extends \PHPUnit_Framework_TestCase { protected $object; - + protected $objects; protected $reflection; @@ -16,16 +16,16 @@ class LayoutTest extends \PHPUnit_Framework_TestCase protected $filesPath= 'tests/testData/FileManager'; protected function setUp() - { - $this->objects['fileManager'] = $this->getMockBuilder('\\Espo\\Core\\Utils\\File\\Manager')->disableOriginalConstructor()->getMock(); - $this->objects['metadata'] = $this->getMockBuilder('\\Espo\\Core\\Utils\\Metadata')->disableOriginalConstructor()->getMock(); + { + $this->objects['fileManager'] = $this->getMockBuilder('\\Espo\\Core\\Utils\\File\\Manager')->disableOriginalConstructor()->getMock(); + $this->objects['metadata'] = $this->getMockBuilder('\\Espo\\Core\\Utils\\Metadata')->disableOriginalConstructor()->getMock(); $this->object = new \Espo\Core\Utils\Layout($this->objects['fileManager'], $this->objects['metadata']); - $this->reflection = new ReflectionHelper($this->object); + $this->reflection = new ReflectionHelper($this->object); $this->reflection->setProperty('params', array( 'application/Espo/Core/defaults', - ) ); + ) ); } protected function tearDown() @@ -33,46 +33,46 @@ class LayoutTest extends \PHPUnit_Framework_TestCase $this->object = NULL; } - + function testGetLayoutPathCore() - { + { $this->objects['metadata'] ->expects($this->exactly(1)) ->method('getScopeModuleName') ->will($this->returnValue(false)); - - $this->assertEquals('application/Espo/Resources/layouts/User', $this->reflection->invokeMethod('getLayoutPath', array('User')) ); - $this->assertEquals('custom/Espo/Custom/Resources/layouts/User', $this->reflection->invokeMethod('getLayoutPath', array('User', true)) ); + + $this->assertEquals('application/Espo/Resources/layouts/User', $this->reflection->invokeMethod('getLayoutPath', array('User')) ); + $this->assertEquals('custom/Espo/Custom/Resources/layouts/User', $this->reflection->invokeMethod('getLayoutPath', array('User', true)) ); } - - + + function testGetLayoutPathModule() { $this->objects['metadata'] ->expects($this->exactly(1)) ->method('getScopeModuleName') ->will($this->returnValue('Crm')); - - $this->assertEquals('application/Espo/Modules/Crm/Resources/layouts/Call', $this->reflection->invokeMethod('getLayoutPath', array('Call')) ); + + $this->assertEquals('application/Espo/Modules/Crm/Resources/layouts/Call', $this->reflection->invokeMethod('getLayoutPath', array('Call')) ); $this->assertEquals('custom/Espo/Custom/Resources/layouts/Call', $this->reflection->invokeMethod('getLayoutPath', array('Call', true)) ); } - + function testGet() - { - $result = '[{"label":"Overview","rows":[[{"name":"userName"},{"name":"isAdmin"}],[{"name":"name"},{"name":"title"}],[{"name":"defaultTeam"}],[{"name":"emailAddress"},{"name":"phone"}]]}]'; - + { + $result = '[{"label":"Overview","rows":[[{"name":"userName"},{"name":"isAdmin"}],[{"name":"name"},{"name":"title"}],[{"name":"defaultTeam"}],[{"name":"emailAddress"},{"name":"phone"}]]}]'; + $this->objects['metadata'] ->expects($this->exactly(1)) ->method('getScopeModuleName') - ->will($this->returnValue(false)); - + ->will($this->returnValue(false)); + $this->objects['fileManager'] ->expects($this->exactly(1)) ->method('getContents') ->will($this->returnValue($result)); - - $this->assertEquals($result, $this->object->get('User', 'detail')); - } + + $this->assertEquals($result, $this->object->get('Note', 'detail')); + } diff --git a/tests/testData/Utils/Config/config.php b/tests/testData/Utils/Config/config.php index d9bb88df2e..7c1238f8f1 100644 --- a/tests/testData/Utils/Config/config.php +++ b/tests/testData/Utils/Config/config.php @@ -101,23 +101,8 @@ return array ( 7 => 'Case', 8 => 'Prospect', ), - 'crud' => - array ( - 'get' => 'read', - 'post' => 'create', - 'put' => 'update', - 'patch' => 'patch', - 'delete' => 'delete', - ), - 'systemUser' => - array ( - 'id' => 'system', - 'userName' => 'system', - 'firstName' => '', - 'lastName' => 'System', - ), 'isInstalled' => true, - 'cacheTimestamp' => 1401873639, + 'cacheTimestamp' => 1401876283, 'testOption' => 'Another Wrong Value', 'testOption2' => 'Test2', );