test: add ArrayBag tests

This commit is contained in:
Khoubza Younes
2023-01-31 23:40:54 +01:00
parent 0db8811db8
commit 6c2baa8d01
2 changed files with 35 additions and 2 deletions
+2 -2
View File
@@ -12,12 +12,12 @@ use Flasher\Prime\Notification\Envelope;
interface BagInterface
{
/**
* @return array<string, Envelope>
* @return Envelope[]
*/
public function get();
/**
* @param array<string, Envelope> $envelopes
* @param Envelope[] $envelopes
*
* @return void
*/
+33
View File
@@ -0,0 +1,33 @@
<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
*/
namespace Flasher\Tests\Prime\Storage\Bag;
use Flasher\Prime\Notification\Envelope;
use Flasher\Prime\Notification\Notification;
use Flasher\Prime\Storage\Bag\ArrayBag;
use Flasher\Tests\Prime\TestCase;
class ArrayBagTest extends TestCase
{
/**
* @return void
*/
public function testArrayBag()
{
$bag = new ArrayBag();
$envelopes = array(
new Envelope(new Notification()),
new Envelope(new Notification()),
);
$bag->set($envelopes);
$this->assertEquals($envelopes, $bag->get());
}
}