Created
April 10, 2013 15:17
-
-
Save JeroenDeDauw/5355528 to your computer and use it in GitHub Desktop.
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
public function testInsertEntity() { | |
$item = Item::newEmpty(); | |
$item->setId( 42 ); | |
$queryInterface = new ObservableQueryInterface(); | |
$assertEquals = array( $this, 'assertEquals' ); | |
$queryInterface->registerCallback( | |
'insert', | |
function( $tableName, array $values ) use ( $assertEquals ) { | |
call_user_func( | |
$assertEquals, | |
'nyan_entities', | |
$tableName, | |
'The only insert call should be to the entities table' | |
); | |
call_user_func( | |
$assertEquals, | |
'nyan_entities', | |
array( | |
'type' => 'item', | |
'number' => 42, | |
), | |
'The entity info should be inserted correctly' | |
); | |
} | |
); | |
$updater = new Updater( $this->newStoreSchema(), $queryInterface ); | |
$updater->insertEntity( $item ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment