Adds asArray() method to the base Model that's used as proxy for
Idiorm's as_array()
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Codeception\Util\Stub;
|
||||
use MailPoet\Models\Model;
|
||||
|
||||
class ModelTest extends MailPoetTest {
|
||||
function testItRethrowsPDOExceptions() {
|
||||
@ -23,7 +22,26 @@ class ModelTest extends MailPoetTest {
|
||||
expect($e instanceof \PDOException)->false();
|
||||
expect($e->getMessage())->equals($message);
|
||||
}
|
||||
// Remove the DB stub
|
||||
}
|
||||
|
||||
function testItConvertsModelObjectToArray() {
|
||||
$model = Model::create();
|
||||
$model->first = 'first';
|
||||
$model->last = 'last';
|
||||
expect($model->asArray('first'))->equals(
|
||||
array(
|
||||
'first' => 'first'
|
||||
)
|
||||
);
|
||||
expect($model->asArray('last', 'first'))->equals(
|
||||
array(
|
||||
'last' => 'last',
|
||||
'first' => 'first'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function _after() {
|
||||
\ORM::setDb(null);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user