Activity example



namespace Symfony\Component\Notifier\Bridge\MicrosoftTeams\Tests\Section\Field;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Notifier\Bridge\MicrosoftTeams\Section\Field\Activity;

final class ActivityTest extends TestCase
{
    public function testImage()
    {
        $field = (new Activity())
            ->image($value = 'https://symfony.com/logo.png');

        $this->assertSame($value$field->toArray()['activityImage']);
    }

    public function testTitle()
    {
        $field = (new Activity())
            ->title($value = 'Symfony is great!');

        $this->assertSame($value$field->toArray()['activityTitle']);
    }
public static function allowedActions(): \Generator
    {
        yield [[['@type' => 'ActionCard']]new ActionCard()];
        yield [[['@type' => 'HttpPOST']]new HttpPostAction()];
        yield [[['@type' => 'InvokeAddInCommand']]new InvokeAddInCommandAction()];
        yield [[['@type' => 'OpenUri']]new OpenUriAction()];
    }

    public function testActivity()
    {
        $activity = (new Activity())
            ->image($imageUrl = 'https://symfony.com/logo.png')
            ->title($title = 'Activities')
            ->subtitle($subtitle = 'for Admins only')
            ->text($text = 'Hey Symfony!');

        $section = (new Section())
            ->activity($activity);

        $this->assertSame(
            [
                'activityImage' => $imageUrl,
                
Home | Imprint | This part of the site doesn't use cookies.