mirror of
https://github.com/elyby/php-tempmailbuster.git
synced 2025-05-31 14:11:41 +05:30
Static Loader class was refactored into AntiTempmailRepo class.
Added LoaderInterface. Added fromLoader creator for Storage.
This commit is contained in:
45
tests/Loader/AntiTempmailRepoTest.php
Normal file
45
tests/Loader/AntiTempmailRepoTest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
namespace Ely\TempMailBuster\Loader;
|
||||
|
||||
class AntiTempmailRepoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testLoad()
|
||||
{
|
||||
$loader = new AntiTempmailRepo();
|
||||
$this->assertTrue(is_array($loader->load()));
|
||||
}
|
||||
|
||||
public function testLoadExceptionWrongPaths()
|
||||
{
|
||||
$this->expectException('Exception');
|
||||
$loader = new AntiTempmailRepoWithWrongPaths();
|
||||
$loader->load();
|
||||
}
|
||||
|
||||
public function testLoadExceptionInvalidJson()
|
||||
{
|
||||
$this->expectException('Exception');
|
||||
$loader = new AntiTempmailRepoWithInvalidJson();
|
||||
$loader->load();
|
||||
}
|
||||
}
|
||||
|
||||
class AntiTempmailRepoWithWrongPaths extends AntiTempmailRepo
|
||||
{
|
||||
protected function getPaths()
|
||||
{
|
||||
return [
|
||||
__DIR__ . '/virtual_reality.json',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
class AntiTempmailRepoWithInvalidJson extends AntiTempmailRepo
|
||||
{
|
||||
protected function getPaths()
|
||||
{
|
||||
return [
|
||||
__DIR__ . '/AntiTempmailRepoTest.php',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user