Skip to content

Commit

Permalink
afup#1437 fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz committed Oct 23, 2024
1 parent 34d086f commit eb9130f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
8 changes: 6 additions & 2 deletions sources/AppBundle/Event/Model/Speaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function setLastname($lastname)
*/
public function getLabel()
{
return $this->getFirstname() . " " . mb_strtoupper($this->getLastname());
return $this->getFirstname() . " " . ($this->getLastname() ? mb_strtoupper($this->getLastname()) : null);
}

/**
Expand Down Expand Up @@ -413,10 +413,14 @@ public function getMastodon()
public function getCleanedTwitter()
{
$twitter = $this->getTwitter();
if (!$twitter) {
return null;
}

$twitter = trim($twitter, '@');
$twitter = preg_replace('!^https?://twitter.com/!', '', $twitter);

if (0 === strlen(trim($twitter))) {
if (!$twitter) {
return null;
}

Expand Down
13 changes: 6 additions & 7 deletions sources/AppBundle/Event/Model/Talk.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public function setNeedsMentoring($needsMentoring)
*/
public function getYoutubeId()
{
if (0 === strlen($this->youTubeId)) {
if (empty($this->youTubeId)) {
return null;
}

Expand Down Expand Up @@ -475,7 +475,7 @@ public function getYoutubeUrl()
*/
public function getSlidesUrl()
{
if (0 === strlen($this->slidesUrl)) {
if (empty($this->slidesUrl)) {
return null;
}

Expand Down Expand Up @@ -591,7 +591,7 @@ public function getOpenfeedbackUrl()
*/
public function getBlogPostUrl()
{
if (0 === strlen($this->blogPostUrl)) {
if (empty($this->blogPostUrl)) {
return null;
}

Expand Down Expand Up @@ -624,7 +624,7 @@ public function hasBlogPostUrl()
*/
public function getInterviewUrl()
{
if (0 === strlen($this->interviewUrl)) {
if (empty($this->interviewUrl)) {
return null;
}

Expand Down Expand Up @@ -895,12 +895,11 @@ public function getTweetsHasArray()
$explodedTweets = explode(PHP_EOL, $this->getTweets());
$returnedTweets = [];
foreach ($explodedTweets as $explodedTweet) {
$explodedTweet = trim($explodedTweet);
if (0 === strlen($explodedTweet)) {
if (empty($explodedTweet)) {
continue;
}

$returnedTweets[] = $explodedTweet;
$returnedTweets[] = trim($explodedTweet);
}

return $returnedTweets;
Expand Down
5 changes: 3 additions & 2 deletions sources/AppBundle/Payment/Paybox.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ private function generatePbxBiling(PayboxBilling $payboxBilling)

private function preparePbxBillingValue($value, $maxLength, $default)
{
$value = trim($value);
$value = $value ? trim($value) : '';

if (0 === strlen($value)) {
if ($value === '') {
$value = $default;
}

$value = (string) $value;
if (strlen($value) > $maxLength) {
$value = substr($value, 0, $maxLength);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/units/AppBundle/Indexation/Talks/Transformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testTransform()
->then
->array($transformer->transform($planning, $talk, $event, $speakers))
->isEqualTo([
'planning_id' => "266",
'planning_id' => 266,
'talk_id' => 1007,
'url_key' => '1007-utiliser-postgresql-en-2014',
'title' => "Utiliser PostgreSQL en 2014",
Expand Down

0 comments on commit eb9130f

Please sign in to comment.