DiscordFieldEmbedObject example

use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordEmbed;
use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordFieldEmbedObject;
use Symfony\Component\Notifier\Exception\LengthException;

final class DiscordEmbedTest extends TestCase
{
    public function testCanBeInstantiated()
    {
        $embed = (new DiscordEmbed())
            ->title('foo')
            ->description('bar')
            ->addField((new DiscordFieldEmbedObject())
                ->name('baz')
                ->value('qux')
            );

        $this->assertSame([
            'title' => 'foo',
            'description' => 'bar',
            'fields' => [
                [
                    'name' => 'baz',
                    'value' => 'qux',
                ],
namespace Symfony\Component\Notifier\Bridge\Discord\Tests\Embeds;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordFieldEmbedObject;
use Symfony\Component\Notifier\Exception\LengthException;

final class DiscordFieldEmbedObjectTest extends TestCase
{
    public function testCanBeInstantiated()
    {
        $field = (new DiscordFieldEmbedObject())
            ->name('foo')
            ->value('bar')
            ->inline(true);

        $this->assertSame([
            'name' => 'foo',
            'value' => 'bar',
            'inline' => true,
        ]$field->toArray());
    }

    
Home | Imprint | This part of the site doesn't use cookies.