Skip to content

Instantly share code, notes, and snippets.

@JeroenDeDauw
Created April 10, 2013 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeroenDeDauw/5355528 to your computer and use it in GitHub Desktop.
Save JeroenDeDauw/5355528 to your computer and use it in GitHub Desktop.
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