Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a ProfileTest testing if the getters and setters of a profile …
…work
- Loading branch information
1 parent
0c74dc5
commit cad9074
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
src/Frontend/Modules/Profiles/Tests/Engine/ProfileTest.php
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,60 @@ | ||
<?php | ||
|
||
namespace Frontend\Modules\Profiles\Tests\Engine; | ||
|
||
use Common\WebTestCase; | ||
use Frontend\Modules\Profiles\Engine\Profile; | ||
|
||
final class ProfileTest extends WebTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
if (!defined('APPLICATION')) { | ||
define('APPLICATION', 'Frontend'); | ||
} | ||
|
||
$client = self::createClient(); | ||
$this->loadFixtures($client); | ||
} | ||
|
||
public function testCreatingProfile(): void | ||
{ | ||
$profile = new Profile(); | ||
|
||
$profile->setDisplayName('Fork CMS'); | ||
$this->assertEquals('Fork CMS', $profile->getDisplayName()); | ||
|
||
$profile->setEmail('info@fork-cms.com'); | ||
$this->assertEquals('info@fork-cms.com', $profile->getEmail()); | ||
|
||
$profile->setRegisteredOn(1234567890); | ||
$this->assertEquals(1234567890, $profile->getRegisteredOn()); | ||
|
||
$profile->setStatus('random_status'); | ||
$this->assertEquals('random_status', $profile->getStatus()); | ||
|
||
$profile->setUrl('fork-cms'); | ||
$this->assertEquals('fork-cms', $profile->getUrl()); | ||
|
||
// @TODO These settings setters don't work because the profile doesn't have an ID, this should be fixed | ||
/*$profile->setSettings( | ||
[ | ||
'my_first_setting' => 'My first value', | ||
'my_second_setting' => 'My second value', | ||
] | ||
); | ||
$this->assertEquals( | ||
[ | ||
'my_first_setting' => 'My first value', | ||
'my_second_setting' => 'My second value', | ||
], | ||
$profile->getSettings() | ||
); | ||
$this->assertEquals('My first value', $profile->getSetting('my_first_setting')); | ||
$profile->setSetting('my_second_setting', 'My updated value'); | ||
$this->assertEquals('My updated value', $profile->getSetting('my_second_setting'));*/ | ||
} | ||
} |