Hello Komirad Use this laravel debuger : https://github.com/barryvdh/laravel-debugbar
whatever you need this library provide you.
I am trying to test a method that has a few possible outcomes. Successful outcomes result in the model being saved, can I write a unit test and test it without actually saving the model?
Here's the method, any help is appreciated.
class PollAndDownload {
public function __construct(MySession $session)
{
$this->session = $session;
}
protected function syncAdGroup($operandAdGroup, $batchJobAdGroups)
{
$adGroupModels = AdGroup::where('adGroupId', $operandAdGroup->getId())->get();
if (count($adGroupModels)) {
// Update existing
foreach ($adGroupModels as $adGroupModel) {
$adGroupModel->syncBack($operandAdGroup);
$adGroupModel->save(); // Success
}
} else {
// Handle newly published
foreach ($batchJobAdGroups as $adGroupModel) {
if ($adGroupModel->name == $operandAdGroup->getName() &&
$adGroupModel->campaign->fieldsHelper()->id == $operandAdGroup->getCampaignId()
) {
$adGroupModel->syncBack($operandAdGroup);
$adGroupModel->save(); // Success
}
}
}
}
}
Please or to participate in this conversation.