Conditions | 1 |
Paths | 1 |
Total Lines | 59 |
Code Lines | 43 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
29 | public function testPaymentSetPaid() |
||
30 | { |
||
31 | $request = $this->prophet->prophesize('Symfony\Component\HttpFoundatio\Request'); |
||
32 | $request->willExtend('Symfony\Component\HttpFoundation\Request'); |
||
33 | |||
34 | $wayforpayService = $this->prophet->prophesize('Application\Bundle\DefaultBundle\Service\WayForPayService'); |
||
35 | $paymentService = $this->prophet->prophesize('Application\Bundle\DefaultBundle\Service\PaymentService'); |
||
36 | |||
37 | $container = $this->prophet->prophesize('Symfony\Component\DependencyInjection\Container'); |
||
38 | $doctrine = $this->prophet->prophesize('Doctrine\Bundle\DoctrineBundle\Registry'); |
||
39 | $em = $this->prophet->prophesize('Doctrine\ORM\EntityManager'); |
||
40 | $paymentRepository = $this->prophet->prophesize('Stfalcon\Bundle\EventBundle\Repository\PaymentRepository'); |
||
41 | $payment = $this->prophet->prophesize('Stfalcon\Bundle\EventBundle\Entity\Payment'); |
||
42 | $logger = $this->prophet->prophesize('Symfony\Bridge\Monolog\Logger'); |
||
43 | $referralService = $this->prophet->prophesize('Application\Bundle\DefaultBundle\Service\ReferralService'); |
||
44 | $session = $this->prophet->prophesize('Symfony\Component\HttpFoundation\Session\Session'); |
||
45 | |||
46 | $request->getContent()->shouldBeCalled() |
||
47 | ->willReturn('{"orderNo":"1"}'); |
||
48 | |||
49 | $doctrine->getRepository('StfalconEventBundle:Payment') |
||
50 | ->shouldBeCalled() |
||
51 | ->willReturn($paymentRepository); |
||
52 | |||
53 | $doctrine->getManager()->willReturn($em); |
||
54 | |||
55 | $payment->isPending()->shouldBeCalled()->willReturn(true); |
||
56 | $payment->setPaidWithGate(Payment::WAYFORPAY_GATE)->shouldBeCalled(); |
||
57 | |||
58 | $session->set('way_for_pay_payment', 1)->shouldBeCalled()->willReturn(null); |
||
59 | |||
60 | $referralService->chargingReferral($payment)->shouldBeCalled()->willReturn(null); |
||
61 | $referralService->utilizeBalance($payment)->shouldBeCalled()->willReturn(null); |
||
62 | |||
63 | $container->has('doctrine')->willReturn(true); |
||
64 | $container->get('doctrine')->willReturn($doctrine); |
||
65 | |||
66 | $paymentRepository->findOneBy(Argument::any())->willReturn($payment); |
||
67 | |||
68 | $container->get('app.way_for_pay.service')->willReturn($wayforpayService); |
||
69 | $container->get('stfalcon_event.referral.service')->willReturn($referralService); |
||
70 | $container->get('stfalcon_event.payment.service')->willReturn($paymentService); |
||
71 | $container->get('logger')->willReturn($logger); |
||
72 | $container->get('session')->willReturn($session); |
||
73 | |||
74 | $wayforpayService->checkPayment(Argument::any(), Argument::any()) |
||
75 | ->willReturn(true) |
||
76 | ->shouldBeCalled(); |
||
77 | $wayforpayService->saveResponseLog($payment, Argument::any(), 'set paid')->willReturn(null) |
||
78 | ->shouldBeCalled(); |
||
79 | $wayforpayService->getResponseOnServiceUrl(Argument::any())->willReturn([]) |
||
80 | ->shouldBeCalled(); |
||
81 | $em->flush()->shouldBeCalled(); |
||
82 | |||
83 | $wayforpayController = new WayForPayController(); |
||
84 | $wayforpayController->setContainer($container->reveal()); |
||
85 | $result = $wayforpayController->serviceInteractionAction($request->reveal()); |
||
86 | |||
87 | $this->assertEquals(200, $result->getStatusCode()); |
||
88 | } |
||
127 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths