-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51f3b47
commit 46579d7
Showing
8 changed files
with
69 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
includes: | ||
- ./vendor/larastan/larastan/extension.neon | ||
|
||
parameters: | ||
|
||
paths: | ||
- src | ||
|
||
# 8 is the highest level | ||
level: 5 | ||
|
||
checkMissingIterableValueType: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<directory suffix=".php">./tests/</directory> | ||
<directory suffix=".php">tests</directory> | ||
<exclude>tests/TestCase.php</exclude> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist addUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">./src</directory> | ||
</whitelist> | ||
</filter> | ||
<source> | ||
<include> | ||
<directory>src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,23 +2,24 @@ | |
|
||
namespace Propaganistas\LaravelDisposableEmail\Tests; | ||
|
||
use PHPUnit\Framework\Attributes\Test; | ||
use Propaganistas\LaravelDisposableEmail\DisposableDomains; | ||
|
||
class DisposableDomainsTest extends TestCase | ||
{ | ||
/** @test */ | ||
#[Test] | ||
public function it_can_be_resolved_using_alias() | ||
{ | ||
$this->assertEquals(DisposableDomains::class, get_class($this->app->make('disposable_email.domains'))); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_can_be_resolved_using_class() | ||
{ | ||
$this->assertEquals(DisposableDomains::class, get_class($this->app->make(DisposableDomains::class))); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_can_get_storage_path() | ||
{ | ||
$this->assertEquals( | ||
|
@@ -27,15 +28,15 @@ public function it_can_get_storage_path() | |
); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_can_set_storage_path() | ||
{ | ||
$this->disposable()->setStoragePath('foo'); | ||
|
||
$this->assertEquals('foo', $this->disposable()->getStoragePath()); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_can_get_cache_key() | ||
{ | ||
$this->assertEquals( | ||
|
@@ -44,15 +45,15 @@ public function it_can_get_cache_key() | |
); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_can_set_cache_key() | ||
{ | ||
$this->disposable()->setCacheKey('foo'); | ||
|
||
$this->assertEquals('foo', $this->disposable()->getCacheKey()); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_takes_cached_domains_if_available() | ||
{ | ||
$this->app['cache.store'][$this->disposable()->getCacheKey()] = ['foo']; | ||
|
@@ -64,7 +65,7 @@ public function it_takes_cached_domains_if_available() | |
$this->assertEquals(['foo'], $domains); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_flushes_invalid_cache_values() | ||
{ | ||
$this->app['cache.store'][$this->disposable()->getCacheKey()] = 'foo'; | ||
|
@@ -74,7 +75,7 @@ public function it_flushes_invalid_cache_values() | |
$this->assertNotEquals('foo', $this->app['cache.store'][$this->disposable()->getCacheKey()]); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_skips_cache_when_configured() | ||
{ | ||
$this->app['config']['disposable-email.cache.enabled'] = false; | ||
|
@@ -86,7 +87,7 @@ public function it_skips_cache_when_configured() | |
$this->assertContains('yopmail.com', $domains); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_takes_storage_domains_when_cache_is_not_available() | ||
{ | ||
$this->app['config']['disposable-email.cache.enabled'] = false; | ||
|
@@ -100,7 +101,7 @@ public function it_takes_storage_domains_when_cache_is_not_available() | |
$this->assertEquals(['foo'], $domains); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_takes_package_domains_when_storage_is_not_available() | ||
{ | ||
$this->app['config']['disposable-email.cache.enabled'] = false; | ||
|
@@ -111,7 +112,7 @@ public function it_takes_package_domains_when_storage_is_not_available() | |
$this->assertContains('yopmail.com', $domains); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_can_flush_storage() | ||
{ | ||
file_put_contents($this->storagePath, 'foo'); | ||
|
@@ -121,15 +122,15 @@ public function it_can_flush_storage() | |
$this->assertFileDoesNotExist($this->storagePath); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_doesnt_throw_exceptions_for_flush_storage_when_file_doesnt_exist() | ||
{ | ||
$this->disposable()->flushStorage(); | ||
|
||
$this->assertTrue(true); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_can_flush_cache() | ||
{ | ||
$this->app['cache.store'][$this->disposable()->getCacheKey()] = 'foo'; | ||
|
@@ -141,7 +142,7 @@ public function it_can_flush_cache() | |
$this->assertNull($this->app['cache']->get($this->disposable()->getCacheKey())); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_can_verify_disposability() | ||
{ | ||
$this->assertTrue($this->disposable()->isDisposable('[email protected]')); | ||
|
@@ -153,15 +154,15 @@ public function it_can_verify_disposability() | |
$this->assertTrue($this->disposable()->isIndisposable('[email protected]')); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_checks_the_full_email_domain() | ||
{ | ||
$this->assertTrue($this->disposable()->isDisposable('[email protected]')); | ||
$this->assertTrue($this->disposable()->isDisposable('[email protected]')); | ||
$this->assertTrue($this->disposable()->isNotDisposable('[email protected]')); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_can_exclude_whitelisted_domains() | ||
{ | ||
$this->disposable()->setWhitelist(['yopmail.com']); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,13 @@ | |
|
||
namespace Propaganistas\LaravelDisposableEmail\Tests\Validation; | ||
|
||
use PHPUnit\Framework\Attributes\Test; | ||
use Propaganistas\LaravelDisposableEmail\Tests\TestCase; | ||
use Propaganistas\LaravelDisposableEmail\Validation\Indisposable; | ||
|
||
class IndisposableTest extends TestCase | ||
{ | ||
/** @test */ | ||
#[Test] | ||
public function it_should_pass_for_indisposable_emails() | ||
{ | ||
$validator = new Indisposable; | ||
|
@@ -16,7 +17,7 @@ public function it_should_pass_for_indisposable_emails() | |
$this->assertTrue($validator->validate(null, $email, null, null)); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_should_fail_for_disposable_emails() | ||
{ | ||
$validator = new Indisposable; | ||
|
@@ -25,7 +26,7 @@ public function it_should_fail_for_disposable_emails() | |
$this->assertFalse($validator->validate(null, $email, null, null)); | ||
} | ||
|
||
/** @test */ | ||
#[Test] | ||
public function it_is_usable_through_the_validator() | ||
{ | ||
$passingValidation = $this->app['validator']->make(['email' => '[email protected]'], ['email' => 'indisposable']); | ||
|