-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 #15009 from phalcon/fix/model-events-manager-retur…
…n-type-hint Changed return type hint for Model::getEventsManager
- Loading branch information
Showing
12 changed files
with
50 additions
and
85 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
* For the full copyright and license information, please view the | ||
* LICENSE.txt file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
@@ -15,6 +15,7 @@ | |
|
||
use DatabaseTester; | ||
use Phalcon\Events\Manager; | ||
use Phalcon\Storage\Exception; | ||
use Phalcon\Test\Fixtures\Migrations\InvoicesMigration; | ||
use Phalcon\Test\Fixtures\Traits\DiTrait; | ||
use Phalcon\Test\Models\Invoices; | ||
|
@@ -28,20 +29,35 @@ class GetSetEventsManagerCest | |
{ | ||
use DiTrait; | ||
|
||
public function _before(DatabaseTester $I) | ||
/** | ||
* @var InvoicesMigration | ||
*/ | ||
private $invoiceMigration; | ||
|
||
/** | ||
* Executed before each test | ||
* | ||
* @param DatabaseTester $I | ||
* @return void | ||
*/ | ||
public function _before(DatabaseTester $I): void | ||
{ | ||
$this->setNewFactoryDefault(); | ||
try { | ||
$this->setNewFactoryDefault(); | ||
} catch (\Exception $e) { | ||
$I->fail($e->getMessage()); | ||
} | ||
|
||
$this->setDatabase($I); | ||
|
||
/** @var PDO $connection */ | ||
$connection = $I->getConnection(); | ||
$migration = new InvoicesMigration($connection); | ||
$migration->clear(); | ||
$this->invoiceMigration = new InvoicesMigration($I->getConnection()); | ||
} | ||
|
||
/** | ||
* Tests Phalcon\Mvc\Model :: getEventsManager() | ||
* | ||
* @param DatabaseTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2020-02-01 | ||
* | ||
|
@@ -53,19 +69,15 @@ public function mvcModelGetEventsManager(DatabaseTester $I) | |
{ | ||
$I->wantToTest('Mvc\Model - getEventsManager()'); | ||
|
||
$title = uniqid('inv-'); | ||
/** @var PDO $connection */ | ||
$connection = $I->getConnection(); | ||
$migration = new InvoicesMigration($connection); | ||
$migration->insert(4, null, 0, $title); | ||
$this->invoiceMigration->insert(4, null, 0, uniqid('inv-', true)); | ||
|
||
$invoice = Invoices::findFirst(); | ||
$manager = new Manager(); | ||
|
||
$I->assertFalse( | ||
$I->assertNull( | ||
$invoice->getEventsManager() | ||
); | ||
|
||
$manager = new Manager(); | ||
$invoice->setEventsManager($manager); | ||
|
||
$I->assertEquals( | ||
|
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