-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test scripts for improved coverage and precision settings.
Signed-off-by: Sam Poyigi <[email protected]>
- Loading branch information
Showing
6 changed files
with
192 additions
and
5 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
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,14 @@ | ||
<?php | ||
|
||
namespace Igniter\Frontend\Tests\Models; | ||
|
||
use Igniter\Frontend\Models\CaptchaSettings; | ||
use Igniter\System\Actions\SettingsModel; | ||
|
||
it('configures captcha settings model correctly', function() { | ||
$model = new CaptchaSettings; | ||
|
||
expect($model->implement)->toContain(SettingsModel::class) | ||
->and($model->settingsCode)->toEqual('igniter_frontend_captchasettings') | ||
->and($model->settingsFieldsConfig)->toEqual('captchasettings'); | ||
}); |
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,58 @@ | ||
<?php | ||
|
||
namespace Igniter\Frontend\Tests\Models; | ||
|
||
use Igniter\Frontend\Models\MailchimpSettings; | ||
use Igniter\System\Actions\SettingsModel; | ||
|
||
it('returns true when api_key and list_id are configured', function() { | ||
MailchimpSettings::set([ | ||
'api_key' => 'some-api-key', | ||
'list_id' => 'some-list-id', | ||
]); | ||
|
||
$result = MailchimpSettings::isConfigured(); | ||
|
||
expect($result)->toBeTrue(); | ||
}); | ||
|
||
it('returns false when api_key is not configured', function() { | ||
MailchimpSettings::set([ | ||
'api_key' => '', | ||
'list_id' => 'some-list-id', | ||
]); | ||
|
||
$result = MailchimpSettings::isConfigured(); | ||
|
||
expect($result)->toBeFalse(); | ||
}); | ||
|
||
it('returns false when list_id is not configured', function() { | ||
MailchimpSettings::set([ | ||
'api_key' => 'some-api-key', | ||
'list_id' => '', | ||
]); | ||
|
||
$result = MailchimpSettings::isConfigured(); | ||
|
||
expect($result)->toBeFalse(); | ||
}); | ||
|
||
it('returns false when both api_key and list_id are not configured', function() { | ||
MailchimpSettings::set([ | ||
'api_key' => '', | ||
'list_id' => '', | ||
]); | ||
|
||
$result = MailchimpSettings::isConfigured(); | ||
|
||
expect($result)->toBeFalse(); | ||
}); | ||
|
||
it('configures captcha settings model correctly', function() { | ||
$model = new MailchimpSettings; | ||
|
||
expect($model->implement)->toContain(SettingsModel::class) | ||
->and($model->settingsCode)->toEqual('igniter_frontend_mailchimpsettings') | ||
->and($model->settingsFieldsConfig)->toEqual('mailchimpsettings'); | ||
}); |
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,10 +2,11 @@ | |
|
||
namespace Igniter\Frontend\Tests\Models; | ||
|
||
use Igniter\Frontend\Models\MailchimpSettings; | ||
use Igniter\Frontend\Models\Subscriber; | ||
use Illuminate\Support\Facades\Event; | ||
|
||
it('subscribes an email', function() { | ||
it('subscribes an email to the database', function() { | ||
Event::fake(); | ||
|
||
$email = '[email protected]'; | ||
|
@@ -15,6 +16,20 @@ | |
Event::assertDispatched('igniter.frontend.subscribed'); | ||
}); | ||
|
||
it('subscribes to Mailchimp when listId is provided and configured', function() { | ||
Event::fake(); | ||
MailchimpSettings::set([ | ||
'api_key' => 'some-api-key', | ||
'list_id' => 'some-list-id', | ||
]); | ||
|
||
$email = '[email protected]'; | ||
$listId = 'list-id'; | ||
Subscriber::subscribe($email, $listId); | ||
|
||
Event::assertDispatched('igniter.frontend.subscribed'); | ||
}); | ||
|
||
it('configures subscriber model correctly', function() { | ||
$slider = new Subscriber(); | ||
|
||
|