Skip to content

Commit

Permalink
CS-5713 - Namespace alias can't be detected in Topic service
Browse files Browse the repository at this point in the history
CS-5713 - Namespace alias can't be detected in Topic service

debug

debug travis

travis debug

fix topic service

fix topic service dispatcher

topic service fix
  • Loading branch information
takeit committed Mar 9, 2015
1 parent 71361e7 commit 6973425
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 59 deletions.
84 changes: 41 additions & 43 deletions features/bootstrap/RestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @author Demin Yin <[email protected]>
* @license MIT license
*/

use Behat\Behat\Context\BehatContext;
use Behat\Behat\Context\Step;
use Buzz\Message\Form\FormUpload;
Expand Down Expand Up @@ -159,7 +158,7 @@ public function thatIWantToUnlink()

/**
* @Given /^I\'m autheticated with client "([^"]*)" and secret "([^"]*)"$/
* @param string $clientId
* @param string $clientId
* @return void
* @throws \Exception
*/
Expand All @@ -176,9 +175,9 @@ public function authenitcatedWith($client, $secret)

/**
* @Given /^I\'m logged in as "([^"]*)" with "([^"]*)" with client "([^"]*)" and secret "([^"]*)"$/
* @param string $username
* @param string $password
* @param string $client
* @param string $username
* @param string $password
* @param string $client
* @return void
* @throws \Exception
*/
Expand All @@ -195,7 +194,7 @@ public function authenitcatedAsWithClient($username, $password, $client, $secret

/**
* @Given /^that i have folowing "([^"]*)" data:$/
* @param string $clientId
* @param string $clientId
* @return void
* @throws \Exception
*/
Expand All @@ -208,7 +207,7 @@ public function collectData($dataKey, \Behat\Gherkin\Node\TableNode $data)

/**
* @Given /^that i have "([^"]*)" header with "([^"]*)" value$/
* @param string $clientId
* @param string $clientId
* @return void
* @throws \Exception
*/
Expand Down Expand Up @@ -298,8 +297,8 @@ public function collectLocations($locationIndex)

/**
* @Then /^save "([^"]+)" field under location "([^"]*)"$/
* @param string $fieldName
* @param string $locationIndex
* @param string $fieldName
* @param string $locationIndex
* @return Step\Then|void
* @throws Exception
*/
Expand All @@ -310,13 +309,13 @@ public function saveFieldValueUnderLocation($fieldName, $locationIndex)
if ($this->responseIsJson) {
if ($this->associative) {
if (!(is_array($this->responseData)) || !array_key_exists($fieldName, $this->responseData)) {
throw new \Exception('Field "' . $fieldName . '" is not set!');
throw new \Exception('Field "'.$fieldName.'" is not set!');
}

$fieldValue = $this->responseData[$fieldName];
} else {
if (!($this->responseData instanceof stdClass) || !property_exists($this->responseData, $name)) {
throw new \Exception('Field "' . $fieldName . '" is not set!');
throw new \Exception('Field "'.$fieldName.'" is not set!');
}

$fieldValue = $this->responseData->$fieldName;
Expand All @@ -330,7 +329,7 @@ public function saveFieldValueUnderLocation($fieldName, $locationIndex)

/**
* @When /^I request "([^"]*)"$/
* @param string $pageUrl
* @param string $pageUrl
* @return void
* @throws \Exception
*/
Expand All @@ -353,7 +352,7 @@ public function iRequest($pageUrl)

/**
* @When /^I submit "([^"]*)" data to "([^"]*)"$/
* @param string $pageUrl
* @param string $pageUrl
* @return void
* @throws \Exception
*/
Expand All @@ -363,7 +362,7 @@ public function iSubmitDataTo($dataKey, $pageUrl)
$this->responseIsJson = false;

if ($this->access_token) {
$this->headers['Authorization'] = 'Bearer ' . $this->access_token;
$this->headers['Authorization'] = 'Bearer '.$this->access_token;
}

$this->client->submit(
Expand All @@ -390,8 +389,8 @@ public function processPageUrl($pageUrl)
/**
* This public method is also for other context(s) to process REST API call and inject response into this context.
*
* @param \Buzz\Message\Response $response
* @param boolean $asJson Process the response as JSON or not.
* @param \Buzz\Message\Response $response
* @param boolean $asJson Process the response as JSON or not.
* @return void
*/
public function processResponse(\Buzz\Message\Response $response = null, $asJson = true)
Expand All @@ -407,8 +406,8 @@ public function processResponse(\Buzz\Message\Response $response = null, $asJson
* Process response body. This method may also be used by other context(s) to process REST API call and inject
* response body into this context by using 2nd parameter $asJson.
*
* @param string $jsonData
* @param boolean $asJson
* @param string $jsonData
* @param boolean $asJson
* @return void
*/
protected function processResponseBody($jsonData, $asJson = true)
Expand All @@ -419,7 +418,7 @@ protected function processResponseBody($jsonData, $asJson = true)
$this->responseIsJson = true;
$this->responseDecodeException = null;
} catch (\Exception $e) {
$this->responseData = $jsonData;
$this->responseData = $jsonData;
$this->responseIsJson = false;
$this->responseDecodeException = $e;
}
Expand All @@ -432,7 +431,7 @@ protected function processResponseBody($jsonData, $asJson = true)

/**
* @Then /^the response is( not)? JSON$/
* @param string $notJson
* @param string $notJson
* @return void
* @throws \Exception
*/
Expand All @@ -447,19 +446,18 @@ public function theResponseIsJson($notJson = '')
$message .= $this->responseDecodeException->getMessage();
}

throw new \Exception($message . "\n" . $this->response);
throw new \Exception($message."\n".$this->response);
}
} else {
if ($this->responseIsJson) {
throw new \Exception("Response was JSON\n" . $this->response);
throw new \Exception("Response was JSON\n".$this->response);
}
}

}

/**
* @Given /^the response should contain field "([^"]*)"$/
* @param string $name
* @param string $name
* @return void
* @throws \Exception
*/
Expand All @@ -468,11 +466,11 @@ public function theResponseHasAField($name)
if ($this->responseIsJson) {
if ($this->associative) {
if (!(is_array($this->responseData)) || !array_key_exists($name, $this->responseData)) {
throw new \Exception('Field "' . $name . '" is not set!');
throw new \Exception('Field "'.$name.'" is not set!');
}
} else {
if (!($this->responseData instanceof stdClass) || !property_exists($this->responseData, $name)) {
throw new \Exception('Field "' . $name . '" is not set!');
throw new \Exception('Field "'.$name.'" is not set!');
}
}
} else {
Expand All @@ -482,7 +480,7 @@ public function theResponseHasAField($name)

/**
* @Then /^in the response there is no field called "([^"]*)"$/
* @param string $name
* @param string $name
* @return void
* @throws \Exception
*/
Expand All @@ -491,11 +489,11 @@ public function theResponseShouldNotHaveAField($name)
if ($this->responseIsJson) {
if ($this->associative) {
if (is_array($this->responseData) && array_key_exists($name, $this->responseData)) {
throw new \Exception('Field "' . $name . '" should not be there!');
throw new \Exception('Field "'.$name.'" should not be there!');
}
} else {
if (($this->responseData instanceof stdClass) && property_exists($this->responseData, $name)) {
throw new \Exception('Field "' . $name . '" should not be there!');
throw new \Exception('Field "'.$name.'" should not be there!');
}
}
} else {
Expand All @@ -505,8 +503,8 @@ public function theResponseShouldNotHaveAField($name)

/**
* @Then /^field "([^"]+)" in the response should be "([^"]*)"$/
* @param string $fieldName
* @param string $fieldValue
* @param string $fieldName
* @param string $fieldValue
* @return void
* @throws \Exception
*/
Expand Down Expand Up @@ -553,7 +551,7 @@ private function extractValueByGivenLocation($fieldValue)

/**
* @Then /^the response should contain "([^"]*)"$/
* @param string $str
* @param string $str
* @return void
* @throws \Exception
*/
Expand All @@ -570,9 +568,9 @@ public function theResponseShouldContain($str)

/**
* @Then /^field "([^"]+)" in the response should be an? (int|integer) "([^"]*)"$/
* @param string $fieldName
* @param string $type
* @param string $fieldValue
* @param string $fieldName
* @param string $type
* @param string $fieldValue
* @return void
* @throws \Exception
* @todo Need to be better designed.
Expand All @@ -596,7 +594,7 @@ public function fieldIsOfTypeWithValue($fieldName, $type, $fieldValue)
// TODO: We didn't check if the value is as expected here.
break;
default:
throw new \Exception('Unsupported data type: ' . $type);
throw new \Exception('Unsupported data type: '.$type);
break;
}
}
Expand All @@ -607,7 +605,7 @@ public function fieldIsOfTypeWithValue($fieldName, $type, $fieldValue)

/**
* @Then /^the response status code should be (\d+)$/
* @param int $httpStatus
* @param int $httpStatus
* @return void
* @throws \Exception
*/
Expand All @@ -626,7 +624,7 @@ public function theResponseStatusCodeShouldBe($httpStatus)

/**
* @Given /^the response should be "([^"]*)"$/
* @param string $string
* @param string $string
* @return void
* @throws \Exception
*/
Expand All @@ -636,7 +634,7 @@ public function theResponseShouldBe($string)

if ($string != $data) {
throw new \Exception(
sprintf("Unexpected response.\nExpected response:%s\nActual response:\n%s" . $string, $data)
sprintf("Unexpected response.\nExpected response:%s\nActual response:\n%s".$string, $data)
);
}
}
Expand All @@ -647,7 +645,7 @@ public function theResponseShouldBe($string)
*/
public function echoLastResponse()
{
$this->printDebug($this->client->getLastRequest() . "\n\n" . $this->response . "\n\n" . "access_token: " . $this->access_token);
$this->printDebug($this->client->getLastRequest()."\n\n".$this->response."\n\n"."access_token: ".$this->access_token);
}

/**
Expand Down Expand Up @@ -677,7 +675,7 @@ public function getResponseData()
/**
* Decode JSON string.
*
* @param string $string A JSON string.
* @param string $string A JSON string.
* @return mixed
* @throws \Exception
* @see http://www.php.net/json_last_error
Expand Down Expand Up @@ -710,6 +708,6 @@ protected function decodeJson($string)
break;
}

throw new \Exception('JSON decoding error: ' . $message);
throw new \Exception('JSON decoding error: '.$message);
}
}
}
26 changes: 16 additions & 10 deletions newscoop/admin-files/bugreporter/emailus.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once($GLOBALS['g_campsiteDir'].'/classes/Language.php');
require_once $GLOBALS['g_campsiteDir'].'/classes/Language.php';
$translator = \Zend_Registry::get('container')->getService('translator');
global $ADMIN_DIR;
global $Campsite;
Expand All @@ -10,7 +10,7 @@
<tr>
<td colspan="2">
<?php
if (isset($sendWasAttempted) && $sendWasAttempted){
if (isset($sendWasAttempted) && $sendWasAttempted) {
echo "<b>";
echo $translator->trans("We are sorry, but there was a problem sending your bug report.", array(), 'bug_reporting');
echo "</b>";
Expand All @@ -26,9 +26,9 @@
echo $translator->trans("Please take a minute to send us an email.");
echo "<br><br>";
echo $translator->trans("Simply copy and paste the error report below and send it to:", array(), 'bug_reporting');
echo (" <b>");
echo(" <b>");
echo $Campsite["SUPPORT_EMAIL"];
echo ("</b>");
echo("</b>");
?>.
</p>
<p>
Expand All @@ -44,20 +44,26 @@
<td colspan="2"><b><?php echo $translator->trans("Error Report", array(), 'bug_reporting'); ?></b>
<hr noshade size="1" color="black"><br /></td>
</tr>
<?php if (isset($sendWasAttempted) && $sendWasAttempted) { ?>
<?php if (isset($sendWasAttempted) && $sendWasAttempted) {
?>
<tr>
<td nowrap><?php echo $translator->trans("Email:"); ?></td>
<td><?php echo htmlspecialchars($reporter->getEmail()); ?></td>
<td nowrap><?php echo $translator->trans("Email:");
?></td>
<td><?php echo htmlspecialchars($reporter->getEmail());
?></td>
</tr>
<tr>
<td nowrap><?php echo $translator->trans("Description:", array(), 'bug_reporting'); ?></td>
<td><?php echo htmlspecialchars($reporter->getDescription()); ?></td>
<td nowrap><?php echo $translator->trans("Description:", array(), 'bug_reporting');
?></td>
<td><?php echo htmlspecialchars($reporter->getDescription());
?></td>
</tr>
<tr>
<td nowrap>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<?php } ?>
<?php
} ?>
<tr>
<td nowrap><?php echo $translator->trans("Error ID:", array(), 'bug_reporting'); ?></td>
<td><?php echo $reporter->getId(); ?></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,21 @@
use Doctrine\ORM\EntityManager;
use Newscoop\Exception\ResourcesConflictException;
use Doctrine\ORM\Query;
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher as EventDispatcher;
use Newscoop\EventDispatcher\Events\GenericEvent;

/**
* Topcis service
*/
class TopicService
{
/** @var EntityManager */
protected $em;

/** @var EventDispatcher */
protected $dispatcher;

/**
* @param Doctrine\ORM\EntityManager $em
* @param EntityManager $em
* @param EventDispatcher $dispatcher
*/
public function __construct(EntityManager $em, EventDispatcher $dispatcher)
public function __construct(EntityManager $em, $dispatcher)
{
$this->em = $em;
$this->dispatcher = $dispatcher;
Expand Down

0 comments on commit 6973425

Please sign in to comment.