Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions code/app/Athenia/Mail/MessageMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public function build()
$name = $this->receiver->getEmailToName();
$message = $this->subject($this->message->subject)
->to($email, $name)
->from('thehaeckelsociety@gmail.com', 'Project Athenia')
->bcc('thehaeckelsociety@gmail.com', 'Project Athenia')
->from(config('mail.from.address'), config('mail.from.name'))
->view('mailers.' . $this->message->template, $this->message->data);

if ($this->message->reply_to_email) {
Expand Down
597 changes: 299 additions & 298 deletions code/composer.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace Tests\Athenia\Integration\Policies;

use App\Athenia\Policies\BasePolicyAbstract;
use App\Models\Role;
use Tests\DatabaseSetupTrait;
use Tests\Mocks\BasePolicy;
use Tests\TestCase;
use Tests\Traits\RolesTesting;

Expand All @@ -19,8 +19,7 @@ final class BasePolicyAbstractTest extends TestCase

public function testBefore(): void
{
/** @var BasePolicyAbstract $policy */
$policy = $this->getMockForAbstractClass(BasePolicyAbstract::class);
$policy = new BasePolicy();

$this->assertNull($policy->before($this->getUserOfRole(Role::APP_USER)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use App\Athenia\Http\Core\Requests\BaseAssetUploadRequestAbstract;
use RuntimeException;
use Tests\Mocks\AssetUploadRequest;
use Tests\TestCase;

/**
Expand All @@ -15,8 +16,7 @@ final class BaseAssetUploadRequestAbstractTest extends TestCase
{
public function testValidationDataSetsMimeType(): void
{
/** @var BaseAssetUploadRequestAbstract $request */
$request = $this->getMockForAbstractClass(BaseAssetUploadRequestAbstract::class);
$request = new AssetUploadRequest();

$request->replace([
'file_contents' => base64_encode('test'),
Expand All @@ -31,16 +31,14 @@ public function testGetDecodedContentsThrowsException(): void
{
$this->expectException(RuntimeException::class);

/** @var BaseAssetUploadRequestAbstract $request */
$request = $this->getMockForAbstractClass(BaseAssetUploadRequestAbstract::class);
$request = new AssetUploadRequest();

$request->getDecodedContents();
}

public function testGetDecodedContentsReturnsCorrectContents(): void
{
/** @var BaseAssetUploadRequestAbstract $request */
$request = $this->getMockForAbstractClass(BaseAssetUploadRequestAbstract::class);
$request = new AssetUploadRequest();

$request->replace([
'file_contents' => base64_encode('<svg></svg>'),
Expand All @@ -55,16 +53,14 @@ public function testGetFileMimeTypeThrowsException(): void
{
$this->expectException(RuntimeException::class);

/** @var BaseAssetUploadRequestAbstract $request */
$request = $this->getMockForAbstractClass(BaseAssetUploadRequestAbstract::class);
$request = new AssetUploadRequest();

$request->getFileMimeType();
}

public function testGetFileMimeTypeReturnsCorrectContents(): void
{
/** @var BaseAssetUploadRequestAbstract $request */
$request = $this->getMockForAbstractClass(BaseAssetUploadRequestAbstract::class);
$request = new AssetUploadRequest();

$request->replace([
'file_contents' => base64_encode('<svg></svg>'),
Expand Down
20 changes: 7 additions & 13 deletions code/tests/Athenia/Unit/Jobs/CanDisplayOutputAbstractJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@

namespace Tests\Athenia\Unit\Jobs;

use App\Athenia\Jobs\CanDisplayOutputAbstractJob;
use Illuminate\Console\OutputStyle;
use Symfony\Component\Console\Helper\ProgressBar;
use Tests\Mocks\CanDisplayOutputJob;
use Tests\TestCase;

final class CanDisplayOutputAbstractJobTest extends TestCase
{
public function testOutMessageDoesNothingWithoutOutput(): void
{
/** @var CanDisplayOutputAbstractJob $job */
$job = $this->getMockForAbstractClass(CanDisplayOutputAbstractJob::class);
$job = new CanDisplayOutputJob();

$job->outputMessage("hello");
}
Expand All @@ -22,8 +21,7 @@ public function testOutMessageWritesWhenOutputExists(): void
{
$output = mock(OutputStyle::class);

/** @var CanDisplayOutputAbstractJob $job */
$job = $this->getMockForAbstractClass(CanDisplayOutputAbstractJob::class, [$output]);
$job = new CanDisplayOutputJob($output);

$output->shouldReceive('text');

Expand All @@ -32,8 +30,7 @@ public function testOutMessageWritesWhenOutputExists(): void

public function testCreateProgressBarDoesNothingWithoutOutput(): void
{
/** @var CanDisplayOutputAbstractJob $job */
$job = $this->getMockForAbstractClass(CanDisplayOutputAbstractJob::class);
$job = new CanDisplayOutputJob();

$job->createProgress("progress", 100);
}
Expand All @@ -42,8 +39,7 @@ public function testCreateProgressBarWhenOutputExists(): void
{
$output = mock(OutputStyle::class);

/** @var CanDisplayOutputAbstractJob $job */
$job = $this->getMockForAbstractClass(CanDisplayOutputAbstractJob::class, [$output]);
$job = new CanDisplayOutputJob($output);

$output->shouldReceive('isDecorated')->andReturn(false);

Expand All @@ -57,8 +53,7 @@ public function testAdvanceProgressDoesNothingBeforeCreation(): void
{
$output = mock(OutputStyle::class);

/** @var CanDisplayOutputAbstractJob $job */
$job = $this->getMockForAbstractClass(CanDisplayOutputAbstractJob::class, [$output]);
$job = new CanDisplayOutputJob($output);

$output->shouldReceive('isDecorated')->andReturn(false);

Expand All @@ -69,8 +64,7 @@ public function testAdvanceProgressInteractsProperly(): void
{
$output = mock(OutputStyle::class);

/** @var CanDisplayOutputAbstractJob $job */
$job = $this->getMockForAbstractClass(CanDisplayOutputAbstractJob::class, [$output]);
$job = new CanDisplayOutputJob($output);

$output->shouldReceive('isDecorated')->andReturn(false);

Expand Down
3 changes: 1 addition & 2 deletions code/tests/Athenia/Unit/Mail/MessageMailerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public function testBuild(): void
$builtMailer = $messageMailer->build();

$this->assertEquals([['name' => 'Darlene Dora', 'address' => 'darlene@test.com']], $builtMailer->to);
$this->assertEquals([['name' => 'Project Athenia', 'address' => 'thehaeckelsociety@gmail.com']], $builtMailer->from);
$this->assertEquals([['name' => 'Project Athenia', 'address' => 'thehaeckelsociety@gmail.com']], $builtMailer->bcc);
$this->assertEquals([['name' => 'Example', 'address' => 'hello@example.com']], $builtMailer->from);
$this->assertEquals([['name' => null, 'address' => 'john@test.com']], $builtMailer->replyTo);

$this->assertEquals('Test Message', $builtMailer->subject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use App\Athenia\Validators\BaseValidatorAbstract;
use RuntimeException;
use Tests\Mocks\BaseValidator;
use Tests\TestCase;

/**
Expand All @@ -15,8 +16,7 @@ final class BaseValidatorAbstractTest extends TestCase
{
public function testEnsureValidatorAttributePasses(): void
{
/** @var BaseValidatorAbstract $validator */
$validator = $this->getMockForAbstractClass(BaseValidatorAbstract::class);
$validator = new BaseValidator();

$validator->ensureValidatorAttribute('hello', 'hello');
}
Expand All @@ -25,8 +25,7 @@ public function testEnsureValidatorAttributeThrowsException(): void
{
$this->expectException(RuntimeException::class);

/** @var BaseValidatorAbstract $validator */
$validator = $this->getMockForAbstractClass(BaseValidatorAbstract::class);
$validator = new BaseValidator();

$validator->ensureValidatorAttribute('hello', 'hi');
}
Expand Down
39 changes: 39 additions & 0 deletions code/tests/Mocks/AssetUploadRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);

namespace Tests\Mocks;

use App\Athenia\Http\Core\Requests\BaseAssetUploadRequestAbstract;

class AssetUploadRequest extends BaseAssetUploadRequestAbstract
{
/**
* Get the policy action for the guard
*
* @return string
*/
protected function getPolicyAction(): string
{
return "";
}

/**
* Get the class name of the policy that this request utilizes
*
* @return string
*/
protected function getPolicyModel(): string
{
return "";
}

/**
* Gets any additional parameters needed for the policy function
*
* @return array
*/
protected function getPolicyParameters(): array
{
return [];
}
}
9 changes: 9 additions & 0 deletions code/tests/Mocks/BasePolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);

namespace Tests\Mocks;

use App\Athenia\Policies\BasePolicyAbstract;

class BasePolicy extends BasePolicyAbstract
{}
9 changes: 9 additions & 0 deletions code/tests/Mocks/BaseValidator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);

namespace Tests\Mocks;

use App\Athenia\Validators\BaseValidatorAbstract;

class BaseValidator extends BaseValidatorAbstract
{}
9 changes: 9 additions & 0 deletions code/tests/Mocks/CanDisplayOutputJob.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);

namespace Tests\Mocks;

use App\Athenia\Jobs\CanDisplayOutputAbstractJob;

class CanDisplayOutputJob extends CanDisplayOutputAbstractJob
{}