-
Notifications
You must be signed in to change notification settings - Fork 29
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
Showing
20 changed files
with
353 additions
and
554 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 |
---|---|---|
|
@@ -11,9 +11,6 @@ | |
use PhpList\Core\Tests\TestingSupport\Traits\ModelTestTrait; | ||
use RuntimeException; | ||
|
||
/** | ||
* @author Tatevik Grigoryan <[email protected]> | ||
*/ | ||
class AdministratorFixture extends Fixture | ||
{ | ||
use ModelTestTrait; | ||
|
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 |
---|---|---|
|
@@ -12,9 +12,7 @@ | |
use PhpList\Core\Tests\TestingSupport\Traits\ModelTestTrait; | ||
use RuntimeException; | ||
|
||
/** | ||
* @author Tatevik Grigoryan <[email protected]> | ||
*/ | ||
|
||
class AdministratorTokenWithAdministratorFixture extends Fixture | ||
{ | ||
use ModelTestTrait; | ||
|
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 |
---|---|---|
|
@@ -11,9 +11,6 @@ | |
use PhpList\Core\Tests\TestingSupport\Traits\ModelTestTrait; | ||
use RuntimeException; | ||
|
||
/** | ||
* @author Tatevik Grigoryan <[email protected]> | ||
*/ | ||
class DetachedAdministratorTokenFixture extends Fixture | ||
{ | ||
use ModelTestTrait; | ||
|
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 |
---|---|---|
|
@@ -6,17 +6,12 @@ | |
|
||
use DateTime; | ||
use Doctrine\Bundle\FixturesBundle\Fixture; | ||
use Doctrine\DBAL\Connection; | ||
use Doctrine\Persistence\ObjectManager; | ||
use PhpList\Core\Domain\Model\Subscription\Subscriber; | ||
use PhpList\Core\Tests\TestingSupport\Traits\ModelTestTrait; | ||
use RuntimeException; | ||
|
||
/** | ||
* @author Tatevik Grigoryan <[email protected]> | ||
*/ | ||
class SubscriberFixture extends Fixture | ||
{ | ||
use ModelTestTrait; | ||
public function load(ObjectManager $manager): void | ||
{ | ||
$csvFile = __DIR__ . '/Subscriber.csv'; | ||
|
@@ -31,26 +26,43 @@ public function load(ObjectManager $manager): void | |
} | ||
|
||
$headers = fgetcsv($handle); | ||
if ($headers === false) { | ||
throw new RuntimeException('Could not read headers from CSV file.'); | ||
} | ||
|
||
/** @var Connection $connection */ | ||
$connection = $manager->getConnection(); | ||
|
||
$insertQuery = " | ||
INSERT INTO phplist_user_user ( | ||
id, entered, modified, email, confirmed, blacklisted, bouncecount, | ||
uniqid, htmlemail, disabled, extradata | ||
) VALUES ( | ||
:id, :creation_date, :modification_date, :email, :confirmed, :blacklisted, :bounce_count, | ||
:unique_id, :html_email, :disabled, :extra_data | ||
) | ||
"; | ||
|
||
$stmt = $connection->prepare($insertQuery); | ||
|
||
while (($data = fgetcsv($handle)) !== false) { | ||
$row = array_combine($headers, $data); | ||
|
||
$subscriber = new Subscriber(); | ||
$this->setSubjectId($subscriber,(int)$row['id']); | ||
$this->setSubjectProperty($subscriber,'creationDate', new DateTime($row['entered'])); | ||
$this->setSubjectProperty($subscriber,'modificationDate', new DateTime($row['modified'])); | ||
$subscriber->setEmail($row['email']); | ||
$subscriber->setConfirmed((bool) $row['confirmed']); | ||
$subscriber->setBlacklisted((bool) $row['blacklisted']); | ||
$subscriber->setBounceCount((int) $row['bouncecount']); | ||
$subscriber->setUniqueId($row['uniqueid']); | ||
$subscriber->setHtmlEmail((bool) $row['htmlemail']); | ||
$subscriber->setDisabled((bool) $row['disabled']); | ||
$subscriber->setExtraData($row['extradata']); | ||
$manager->persist($subscriber); | ||
$stmt->executeStatement([ | ||
'id' => (int) $row['id'], | ||
'creation_date' => (new DateTime($row['entered']))->format('Y-m-d H:i:s'), | ||
'modification_date' => (new DateTime($row['modified']))->format('Y-m-d H:i:s'), | ||
'email' => $row['email'], | ||
'confirmed' => (bool) $row['confirmed'] ? 1 : 0, | ||
'blacklisted' => (bool) $row['blacklisted'] ? 1 : 0, | ||
'bounce_count' => (int) $row['bouncecount'], | ||
'unique_id' => $row['uniqueid'], | ||
'html_email' => (bool) $row['htmlemail'] ? 1 : 0, | ||
'disabled' => (bool) $row['disabled'] ? 1 : 0, | ||
'extra_data' => $row['extradata'], | ||
]); | ||
} | ||
|
||
fclose($handle); | ||
$manager->flush(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -12,9 +12,6 @@ | |
use PhpList\Core\Tests\TestingSupport\Traits\ModelTestTrait; | ||
use RuntimeException; | ||
|
||
/** | ||
* @author Tatevik Grigoryan <[email protected]> | ||
*/ | ||
class SubscriberListFixture extends Fixture | ||
{ | ||
use ModelTestTrait; | ||
|
@@ -52,10 +49,9 @@ public function load(ObjectManager $manager): void | |
|
||
$manager->persist($admin); | ||
$manager->persist($subscriberList); | ||
$this->setSubjectProperty($subscriberList,'creationDate', new DateTime($row['entered'])); | ||
$manager->flush(); | ||
} | ||
|
||
fclose($handle); | ||
$manager->flush(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -6,19 +6,12 @@ | |
|
||
use DateTime; | ||
use Doctrine\Bundle\FixturesBundle\Fixture; | ||
use Doctrine\DBAL\Connection; | ||
use Doctrine\Persistence\ObjectManager; | ||
use PhpList\Core\Domain\Model\Messaging\SubscriberList; | ||
use PhpList\Core\Domain\Model\Subscription\Subscriber; | ||
use PhpList\Core\Domain\Model\Subscription\Subscription; | ||
use PhpList\Core\Tests\TestingSupport\Traits\ModelTestTrait; | ||
use RuntimeException; | ||
|
||
/** | ||
* @author Tatevik Grigoryan <[email protected]> | ||
*/ | ||
class SubscriptionFixture extends Fixture | ||
{ | ||
use ModelTestTrait; | ||
public function load(ObjectManager $manager): void | ||
{ | ||
$csvFile = __DIR__ . '/Subscription.csv'; | ||
|
@@ -33,27 +26,34 @@ public function load(ObjectManager $manager): void | |
} | ||
|
||
$headers = fgetcsv($handle); | ||
if ($headers === false) { | ||
throw new RuntimeException('Could not read headers from CSV file.'); | ||
} | ||
|
||
while (($data = fgetcsv($handle)) !== false) { | ||
$row = array_combine($headers, $data); | ||
/** @var Connection $connection */ | ||
$connection = $manager->getConnection(); | ||
|
||
$subscriber = new Subscriber(); | ||
$this->setSubjectId($subscriber,(int)$row['userid']); | ||
$manager->persist($subscriber); | ||
$insertSubscriptionQuery = " | ||
INSERT INTO phplist_listuser ( | ||
userid, listid, entered, modified | ||
) VALUES ( | ||
:subscriber_id, :subscriber_list_id, :creation_date, :modification_date | ||
) | ||
"; | ||
|
||
$subscriberList = new SubscriberList(); | ||
$this->setSubjectId($subscriberList,(int)$row['listid']); | ||
$manager->persist($subscriberList); | ||
$subscriptionStmt = $connection->prepare($insertSubscriptionQuery); | ||
|
||
while (($data = fgetcsv($handle)) !== false) { | ||
$row = array_combine($headers, $data); | ||
|
||
$subscription = new Subscription(); | ||
$this->setSubjectProperty($subscription,'subscriber', $subscriber); | ||
$this->setSubjectProperty($subscription,'subscriberList', $subscriberList); | ||
$this->setSubjectProperty($subscription,'creationDate', new DateTime($row['entered'])); | ||
$this->setSubjectProperty($subscription,'modificationDate', new DateTime($row['modified'])); | ||
$manager->persist($subscription); | ||
$subscriptionStmt->executeStatement([ | ||
'subscriber_id' => (int) $row['userid'], | ||
'subscriber_list_id' => (int) $row['listid'], | ||
'creation_date' => (new DateTime($row['entered']))->format('Y-m-d H:i:s'), | ||
'modification_date' => (new DateTime($row['modified']))->format('Y-m-d H:i:s'), | ||
]); | ||
} | ||
|
||
fclose($handle); | ||
$manager->flush(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
* Testcase. | ||
* | ||
* @author Oliver Klee <[email protected]> | ||
* @author Tatevik Grigoryan <[email protected]> | ||
*/ | ||
class AdministratorRepositoryTest extends KernelTestCase | ||
{ | ||
|
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 |
---|---|---|
|
@@ -20,7 +20,6 @@ | |
* Testcase. | ||
* | ||
* @author Oliver Klee <[email protected]> | ||
* @author Tatevik Grigoryan <[email protected]> | ||
*/ | ||
class AdministratorTokenRepositoryTest extends KernelTestCase | ||
{ | ||
|
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
Oops, something went wrong.