Skip to content

Commit 757f17e

Browse files
committed
Fix tests
1 parent 602fb0a commit 757f17e

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

tests/components/CountersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testComponentInitialization(): void
2929
// Check default values of properties
3030
$this->assertEquals('100', $properties['first_value']['default']);
3131
$this->assertEquals('^[0-9]+$', $properties['first_value']['validationPattern']);
32-
$this->assertEquals('Value can contain only numeric symbols', $properties['first_value']['validationMessage']);
32+
$this->assertEquals('numencode.widgets::lang.validation.numeric', $properties['first_value']['validationMessage']);
3333
}
3434

3535
/**

tests/components/GalleryTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php namespace NumenCode\Widgets\Tests\Components;
22

3-
use Mockery;
43
use PluginTestCase;
54
use NumenCode\Widgets\Components\Gallery;
65
use NumenCode\Widgets\Models\GalleryGroup;
6+
use Mockery;
77

88
class GalleryTest extends PluginTestCase
99
{
@@ -23,10 +23,12 @@ public function testComponentInitialization(): void
2323
$properties = $component->defineProperties();
2424
$this->assertArrayHasKey('title', $properties);
2525
$this->assertArrayHasKey('layout', $properties);
26+
$this->assertArrayHasKey('items_per_row', $properties);
2627

2728
// Check default values
2829
$this->assertEquals('default', $properties['title']['default']);
2930
$this->assertEquals('default', $properties['layout']['default']);
31+
$this->assertEquals('4', $properties['items_per_row']['default']);
3032
}
3133

3234
/**
@@ -59,31 +61,29 @@ public function testGetLayoutOptions(): void
5961

6062
$layoutOptions = $component->getLayoutOptions();
6163
$this->assertArrayHasKey('default', $layoutOptions);
62-
$this->assertArrayHasKey('media', $layoutOptions);
6364
$this->assertEquals('Default', $layoutOptions['default']);
64-
$this->assertEquals('Default with pictures', $layoutOptions['media']);
6565
}
6666

6767
/**
68-
* Test the onRun method loads the correct group.
68+
* Test the onRun method loads the correct gallery.
6969
*/
70-
public function testOnRunLoadsGroup(): void
70+
public function testOnRunLoadsGallery(): void
7171
{
72-
// Mock GalleryGroup::find to return a dummy group
72+
// Mock GalleryGroup::find to return a dummy gallery
7373
$mock = Mockery::mock('alias:' . GalleryGroup::class);
7474
$mock->shouldReceive('find')->with(1)->once()->andReturn([
7575
'id' => 1,
76-
'title' => 'Sample Group',
76+
'title' => 'Sample Gallery',
7777
]);
7878

7979
$component = new Gallery();
8080
$component->setProperty('title', 1);
8181

8282
$component->onRun();
8383

84-
$this->assertIsArray($component->group);
85-
$this->assertEquals(1, $component->group['id']);
86-
$this->assertEquals('Sample Group', $component->group['title']);
84+
$this->assertIsArray($component->gallery);
85+
$this->assertEquals(1, $component->gallery['id']);
86+
$this->assertEquals('Sample Gallery', $component->gallery['title']);
8787
}
8888

8989
/**
@@ -95,13 +95,13 @@ public function testOnRenderSelectsCorrectLayout(): void
9595

9696
// Mock renderPartial to check the rendered layout
9797
$component->shouldReceive('renderPartial')
98-
->with('@media.htm')
99-
->andReturn('Rendered Media Layout');
98+
->with('@custom.htm')
99+
->andReturn('Rendered Custom Layout');
100100

101-
$component->setProperty('layout', 'media');
101+
$component->setProperty('layout', 'custom');
102102

103103
$output = $component->onRender();
104-
$this->assertEquals('Rendered Media Layout', $output);
104+
$this->assertEquals('Rendered Custom Layout', $output);
105105
}
106106

107107
/**

0 commit comments

Comments
 (0)