Skip to content

Commit

Permalink
Add tests for all BlockElement factory types
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbuckley authored and alek13 committed Feb 24, 2021
1 parent e0948b2 commit 3addf64
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions tests/BlockElementUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,34 @@

use InvalidArgumentException;
use Maknz\Slack\BlockElement;
use Maknz\Slack\BlockElement\Button;

class BlockElementUnitTest extends TestCase
{
public function testFactoryWithArray()
/**
* @dataProvider factoryArrayProvider
*/
public function testFactoryWithArray($type, $class)
{
$element = BlockElement::factory([
'type' => 'button',
'type' => $type,
]);

$this->assertInstanceOf(Button::class, $element);
$this->assertInstanceOf($class, $element);
}

public function factoryArrayProvider()
{
return [
['button', BlockElement\Button::class],
['checkboxes', BlockElement\Checkboxes::class],
['datepicker', BlockElement\DatePicker::class],
['image', BlockElement\Image::class],
['multi_static_select', BlockElement\MultiSelect::class],
['overflow', BlockElement\Overflow::class],
['plain_text_input', BlockElement\TextInput::class],
['radio_buttons', BlockElement\RadioButtons::class],
['static_select', BlockElement\Select::class],
];
}

public function testFactoryMissingType()
Expand Down

0 comments on commit 3addf64

Please sign in to comment.