mirror of
https://github.com/elyby/php-tempmailbuster.git
synced 2024-11-28 09:42:25 +05:30
7b82e48cdd
Added LoaderInterface. Added fromLoader creator for Storage.
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
namespace Ely\TempMailBuster;
|
|
|
|
class StorageTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function testGetItems()
|
|
{
|
|
$storage = new Storage(['item']);
|
|
$this->assertEquals(['item'], $storage->getItems());
|
|
}
|
|
|
|
public function testSetItems()
|
|
{
|
|
$storage = new Storage(['item1']);
|
|
$this->assertEquals($storage, $storage->setItems(['item2']));
|
|
$this->assertEquals(['item2'], $storage->getItems());
|
|
}
|
|
|
|
public function testAppendItems()
|
|
{
|
|
$storage = new Storage(['item1']);
|
|
$this->assertEquals($storage, $storage->appendItems(['item2']));
|
|
$this->assertEquals(['item1', 'item2'], $storage->getItems());
|
|
|
|
$storage = new Storage(['item1']);
|
|
$this->assertEquals($storage, $storage->appendItems('item2'));
|
|
$this->assertEquals(['item1', 'item2'], $storage->getItems());
|
|
}
|
|
|
|
public function testFromLoader()
|
|
{
|
|
$this->assertInstanceOf('Ely\TempmailBuster\Storage', Storage::fromLoader(new SimpleLoader()));
|
|
}
|
|
}
|
|
|
|
class SimpleLoader implements LoaderInterface
|
|
{
|
|
public function load()
|
|
{
|
|
return ['foo', 'bar'];
|
|
}
|
|
}
|