* @copyright 2014 Fabian Grutschus. All rights reserved. * @license BSD * @link http://github.com/fabiang/xmpp */ namespace Fabiang\Xmpp\Integration; use Behat\Behat\Context\BehatContext; use Behat\Behat\Exception\PendingException; class RosterContext extends BehatContext { /** * @Given /^Test response data for roster request$/ */ public function testResponseDataForRosterRequest() { $this->getConnection()->setData(array( "" . "", "", "" . "" . "" . "MyGroup" . "MyOtherGroup" . "" . "" . "" )); } /** * @Given /^Roster request send$/ */ public function rosterRequestSend() { $this->getConnection()->send( '' ); } /** * @Then /^options object should contain roster data$/ */ public function optionsObjectShouldContainRosterData() { $users = $this->getConnection()->getOptions()->getUsers(); assertCount(1, $users); /* @var $user \Fabiang\Xmpp\Protocol\User\User */ $user = $users[0]; assertSame('John Doe', $user->getName()); assertSame('john.doe@localhost', $user->getJid()); assertSame('both', $user->getSubscription()); assertSame(array('MyGroup', 'MyOtherGroup'), $user->getGroups()); } /** * * @return \Fabiang\Xmpp\Connection\Test */ public function getConnection() { return $this->getMainContext()->getConnection(); } }