New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix deprecations #51
Merged
martin-georgiev
merged 2 commits into
martin-georgiev:master
from
GwendolenLynch:deprecations
Aug 4, 2019
Merged
Fix deprecations #51
martin-georgiev
merged 2 commits into
martin-georgiev:master
from
GwendolenLynch:deprecations
Aug 4, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pull Request Test Coverage Report for Build 241
💛 - Coveralls |
martin-georgiev
requested changes
Aug 4, 2019
GwendolenLynch
force-pushed
the
deprecations
branch
from
August 4, 2019 09:04
55cec2e
to
6b97589
Compare
martin-georgiev
approved these changes
Aug 4, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work :)
Can you explain why I still have this error?
|
Can you please share more details about the relevant packages you use? |
@martin-georgiev
test file: <?php
namespace App\Tests\Api;
use App\Entity\Origin;
use App\Entity\Website;
use App\Model\Api\Rates\Product;
use App\Model\Api\Rates\Result\Carrier;
use App\Model\Api\Rates\Result\CarrierService;
use App\Model\Api\Rates\Result\Origin as ResultOrigin;
use App\Model\Api\Rates\Shipping;
use App\Service\RatesCalculator;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class RatesTest extends KernelTestCase
{
public function testRates(): void
{
self::bootKernel();
$ratesCalculator = self::$container->get(RatesCalculator::class);
$entityManager = self::$container->get(EntityManagerInterface::class);
$shipping = new Shipping();
$shipping->setWebsite($entityManager->getRepository(Website::class)->findOneBy([]));
$shipping->setCompanyName('company name');
$shipping->setCountry('GB');
$shipping->setPostalCode('NW1 0UR');
$shipping->setCity('London');
$shipping->setAddress('32 Guild Street');
$shipping->setRegionCode('England');
$shipping->setRegionName('England');
$shipping->setContactPhone('+4407883307480');
$shipping->setProducts([
(new Product())
->setQuantity(1.0)
->setPriceWithTax(20.0)
->setPriceWithoutTax(20.0)
->setOrigin($entityManager->getRepository(Origin::class)->findOneBy([]))
->setWeight(1.0),
]);
$result = $ratesCalculator->calculate($shipping);
/** @var ResultOrigin $resultOrigin */
$resultOrigin = $result->first();
/** @var Carrier|false $carrier */
$carrier = $resultOrigin->getCarriers()->first();
$this->assertNotFalse($carrier);
$this->assertTrue($carrier->isSuccess());
/** @var CarrierService|false $service */
$service = $carrier->getServices()->first();
$this->assertNotFalse($service);
$this->assertTrue($service->isSuccess());
}
} composer:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See doctrine/DoctrineBundle#947
Fixes #50
The method is type hinted to
array
sonull
is throwing a type error