Visual Console Refactor: the group item now passes the tests

Former-commit-id: 2a967ef0a23c02fdb89352df65e8d5380cdd31f7
This commit is contained in:
Alejandro Gallardo Escobar 2019-04-08 10:29:30 +02:00
parent 9e74d6f0d1
commit 112f7ab7ed
1 changed files with 64 additions and 55 deletions

View File

@ -23,12 +23,13 @@ class GroupTest extends TestCase
Group::class,
Group::fromArray(
[
'id' => 13,
'type' => GROUP_ITEM,
'width' => '600',
'height' => '500',
'imageSrc' => 'image.jpg',
'groupId' => 12,
'id' => 13,
'type' => GROUP_ITEM,
'width' => '600',
'height' => '500',
'imageSrc' => 'image.jpg',
'groupId' => 12,
'statusImageSrc' => 'image.bad.jpg',
]
)
);
@ -37,12 +38,13 @@ class GroupTest extends TestCase
Group::class,
Group::fromArray(
[
'id' => 1004,
'type' => GROUP_ITEM,
'width' => '600',
'height' => '500',
'image' => 'test_image.png',
'id_group' => 0,
'id' => 1004,
'type' => GROUP_ITEM,
'width' => '600',
'height' => '500',
'image' => 'test_image.png',
'id_group' => 0,
'statusImageSrc' => 'test_image.bad.jpg',
]
)
);
@ -106,36 +108,38 @@ class GroupTest extends TestCase
// Invalid groupId.
Group::fromArray(
[
'id' => 7,
'type' => GROUP_ITEM,
'label' => null,
'labelPosition' => 'up',
'isLinkEnabled' => true,
'isOnTop' => false,
'parentId' => null,
'width' => '0',
'height' => '0',
'x' => -666,
'y' => 76,
'imageSrc' => 'test.jpg',
'groupId' => 'bar',
'id' => 7,
'type' => GROUP_ITEM,
'label' => null,
'labelPosition' => 'up',
'isLinkEnabled' => true,
'isOnTop' => false,
'parentId' => null,
'width' => '0',
'height' => '0',
'x' => -666,
'y' => 76,
'imageSrc' => 'test.jpg',
'groupId' => 'bar',
'statusImageSrc' => 'image.bad.jpg',
]
);
// Missing groupId.
Group::fromArray(
[
'id' => 7,
'type' => GROUP_ITEM,
'label' => null,
'labelPosition' => 'up',
'isLinkEnabled' => true,
'isOnTop' => false,
'parentId' => null,
'width' => '0',
'height' => '0',
'x' => -666,
'y' => 76,
'imageSrc' => 'test.jpg',
'id' => 7,
'type' => GROUP_ITEM,
'label' => null,
'labelPosition' => 'up',
'isLinkEnabled' => true,
'isOnTop' => false,
'parentId' => null,
'width' => '0',
'height' => '0',
'x' => -666,
'y' => 76,
'imageSrc' => 'test.jpg',
'statusImageSrc' => 'image.bad.jpg',
]
);
}
@ -149,29 +153,30 @@ class GroupTest extends TestCase
public function testContainerIsRepresentedAsJson(): void
{
$this->assertEquals(
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":null,"linkedLayoutId":null,"linkedLayoutStatusType":"default","parentId":null,"type":11,"width":0,"x":-666,"y":76}',
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":null,"linkedLayoutId":null,"linkedLayoutStatusType":"default","parentId":null,"statusImageSrc":"image.bad.jpg","type":11,"width":0,"x":-666,"y":76}',
(string) Group::fromArray(
[
'id' => 7,
'type' => GROUP_ITEM,
'label' => null,
'labelPosition' => 'up',
'isLinkEnabled' => true,
'isOnTop' => false,
'parentId' => null,
'width' => '0',
'height' => '0',
'x' => -666,
'y' => 76,
'imageSrc' => 'image.jpg',
'groupId' => 12,
'id' => 7,
'type' => GROUP_ITEM,
'label' => null,
'labelPosition' => 'up',
'isLinkEnabled' => true,
'isOnTop' => false,
'parentId' => null,
'width' => '0',
'height' => '0',
'x' => -666,
'y' => 76,
'imageSrc' => 'image.jpg',
'groupId' => 12,
'statusImageSrc' => 'image.bad.jpg',
]
)
);
// With a linked layout.
$this->assertEquals(
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":null,"linkedLayoutId":1,"linkedLayoutStatusType":"default","parentId":null,"type":11,"width":0,"x":-666,"y":76}',
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":null,"linkedLayoutId":1,"linkedLayoutStatusType":"default","parentId":null,"statusImageSrc":"image.bad.jpg","type":11,"width":0,"x":-666,"y":76}',
(string) Group::fromArray(
[
'id' => 7,
@ -187,13 +192,14 @@ class GroupTest extends TestCase
'y' => 76,
'imageSrc' => 'image.jpg',
'groupId' => 12,
'statusImageSrc' => 'image.bad.jpg',
'id_layout_linked' => 1,
]
)
);
$this->assertEquals(
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":3,"linkedLayoutId":2,"linkedLayoutStatusType":"default","metaconsoleId":5,"parentId":null,"type":11,"width":0,"x":-666,"y":76}',
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":3,"linkedLayoutId":2,"linkedLayoutStatusType":"default","metaconsoleId":5,"parentId":null,"statusImageSrc":"image.bad.jpg","type":11,"width":0,"x":-666,"y":76}',
(string) Group::fromArray(
[
'id' => 7,
@ -209,6 +215,7 @@ class GroupTest extends TestCase
'y' => 76,
'imageSrc' => 'image.jpg',
'groupId' => 12,
'statusImageSrc' => 'image.bad.jpg',
'id_metaconsole' => 5,
'linked_layout_node_id' => 3,
'linkedLayoutId' => 2,
@ -216,7 +223,7 @@ class GroupTest extends TestCase
)
);
$this->assertEquals(
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":3,"linkedLayoutId":2,"linkedLayoutStatusType":"weight","linkedLayoutStatusTypeWeight":80,"metaconsoleId":5,"parentId":null,"type":11,"width":0,"x":-666,"y":76}',
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":3,"linkedLayoutId":2,"linkedLayoutStatusType":"weight","linkedLayoutStatusTypeWeight":80,"metaconsoleId":5,"parentId":null,"statusImageSrc":"image.bad.jpg","type":11,"width":0,"x":-666,"y":76}',
(string) Group::fromArray(
[
'id' => 7,
@ -232,6 +239,7 @@ class GroupTest extends TestCase
'y' => 76,
'imageSrc' => 'image.jpg',
'groupId' => 12,
'statusImageSrc' => 'image.bad.jpg',
'id_metaconsole' => 5,
'linked_layout_node_id' => 3,
'linkedLayoutId' => 2,
@ -241,7 +249,7 @@ class GroupTest extends TestCase
)
);
$this->assertEquals(
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":null,"linkedLayoutId":2,"linkedLayoutStatusType":"service","linkedLayoutStatusTypeCriticalThreshold":80,"linkedLayoutStatusTypeWarningThreshold":50,"parentId":null,"type":11,"width":0,"x":-666,"y":76}',
'{"aclGroupId":null,"groupId":12,"height":0,"id":7,"imageSrc":"image.jpg","isLinkEnabled":true,"isOnTop":false,"label":null,"labelPosition":"up","linkedLayoutAgentId":null,"linkedLayoutId":2,"linkedLayoutStatusType":"service","linkedLayoutStatusTypeCriticalThreshold":80,"linkedLayoutStatusTypeWarningThreshold":50,"parentId":null,"statusImageSrc":"image.bad.jpg","type":11,"width":0,"x":-666,"y":76}',
(string) Group::fromArray(
[
'id' => 7,
@ -257,6 +265,7 @@ class GroupTest extends TestCase
'y' => 76,
'imageSrc' => 'image.jpg',
'groupId' => 12,
'statusImageSrc' => 'image.bad.jpg',
'linkedLayoutId' => 2,
'linked_layout_status_type' => 'service',
'linkedLayoutStatusTypeWarningThreshold' => 50,