-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from liip/add-events
Add events
- Loading branch information
Showing
24 changed files
with
532 additions
and
110 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
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Liip/TestFixturesBundle | ||
* | ||
* (c) Lukas Kahwe Smith <smith@pooteeweet.org> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Liip\TestFixturesBundle\Event; | ||
|
||
// Compatibility layer to use Contract if Symfony\Contracts\EventDispatcher\Event is not available | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
if (class_exists('\Symfony\Component\EventDispatcher\Event')) { | ||
// Symfony < 5.0 | ||
class FixtureEvent extends \Symfony\Component\EventDispatcher\Event | ||
{ | ||
} | ||
} else { | ||
class FixtureEvent extends Event | ||
{ | ||
} | ||
} |
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Liip/TestFixturesBundle | ||
* | ||
* (c) Lukas Kahwe Smith <smith@pooteeweet.org> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Liip\TestFixturesBundle\Event; | ||
|
||
class PostFixtureBackupRestoreEvent extends FixtureEvent | ||
{ | ||
private $backupFilePath; | ||
|
||
public function __construct(string $backupFilePath) | ||
{ | ||
$this->backupFilePath = $backupFilePath; | ||
} | ||
|
||
public function getBackupFilePath(): string | ||
{ | ||
return $this->backupFilePath; | ||
} | ||
} |
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,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Liip/TestFixturesBundle | ||
* | ||
* (c) Lukas Kahwe Smith <smith@pooteeweet.org> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Liip\TestFixturesBundle\Event; | ||
|
||
use Doctrine\Common\DataFixtures\ReferenceRepository; | ||
use Doctrine\Persistence\ObjectManager; | ||
|
||
class PreFixtureBackupRestoreEvent extends FixtureEvent | ||
{ | ||
private $manager; | ||
private $repository; | ||
private $backupFilePath; | ||
|
||
public function __construct( | ||
ObjectManager $manager, | ||
ReferenceRepository $executor, | ||
string $backupFilePath | ||
) { | ||
$this->manager = $manager; | ||
$this->repository = $executor; | ||
$this->backupFilePath = $backupFilePath; | ||
} | ||
|
||
public function getManager(): ObjectManager | ||
{ | ||
return $this->manager; | ||
} | ||
|
||
public function getRepository(): ReferenceRepository | ||
{ | ||
return $this->repository; | ||
} | ||
|
||
public function getBackupFilePath(): string | ||
{ | ||
return $this->backupFilePath; | ||
} | ||
} |
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,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Liip/TestFixturesBundle | ||
* | ||
* (c) Lukas Kahwe Smith <smith@pooteeweet.org> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Liip\TestFixturesBundle\Event; | ||
|
||
use Doctrine\Common\DataFixtures\Executor\AbstractExecutor; | ||
use Doctrine\Persistence\ObjectManager; | ||
|
||
class ReferenceSaveEvent extends FixtureEvent | ||
{ | ||
private $manager; | ||
private $executor; | ||
private $backupFilePath; | ||
|
||
public function __construct( | ||
ObjectManager $manager, | ||
AbstractExecutor $executor, | ||
string $backupFilePath | ||
) { | ||
$this->manager = $manager; | ||
$this->executor = $executor; | ||
$this->backupFilePath = $backupFilePath; | ||
} | ||
|
||
public function getManager(): ObjectManager | ||
{ | ||
return $this->manager; | ||
} | ||
|
||
public function getExecutor(): AbstractExecutor | ||
{ | ||
return $this->executor; | ||
} | ||
|
||
public function getBackupFilePath(): string | ||
{ | ||
return $this->backupFilePath; | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Liip/TestFixturesBundle | ||
* | ||
* (c) Lukas Kahwe Smith <smith@pooteeweet.org> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Liip\TestFixturesBundle; | ||
|
||
use Liip\TestFixturesBundle\Event\FixtureEvent; | ||
use Liip\TestFixturesBundle\Event\PostFixtureBackupRestoreEvent; | ||
use Liip\TestFixturesBundle\Event\PreFixtureBackupRestoreEvent; | ||
use Liip\TestFixturesBundle\Event\ReferenceSaveEvent; | ||
|
||
final class LiipTestFixturesEvents | ||
{ | ||
/** @see PreFixtureBackupRestoreEvent */ | ||
const PRE_FIXTURE_BACKUP_RESTORE = 'liip_test_fixtures.pre_fixture_backup_restore'; | ||
|
||
/** @see FixtureEvent */ | ||
const POST_FIXTURE_SETUP = 'liip_test_fixtures.post_fixture_setup'; | ||
|
||
/** @see PostFixtureBackupRestoreEvent */ | ||
const POST_FIXTURE_BACKUP_RESTORE = 'liip_test_fixtures.post_fixture_backup_restore'; | ||
|
||
/** @see ReferenceSaveEvent */ | ||
const PRE_REFERENCE_SAVE = 'liip_test_fixtures.pre_reference_save'; | ||
|
||
/** @see ReferenceSaveEvent */ | ||
const POST_REFERENCE_SAVE = 'liip_test_fixtures.post_reference_save'; | ||
} |
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.