| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @copyright Aimeos (aimeos.org), 2018 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | namespace Aimeos\Controller\Jobs\Subscription\Process\Renew; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | class StandardTest extends \PHPUnit\Framework\TestCase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | 	private $aimeos; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 	private $context; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	private $object; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 	protected function setUp() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 		$this->aimeos = \TestHelperJobs::getAimeos(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 		$this->context = \TestHelperJobs::getContext(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard( $this->context, $this->aimeos ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 		\Aimeos\MShop\Factory::setCache( true ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	protected function tearDown() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 		\Aimeos\MShop\Factory::setCache( false ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 		\Aimeos\MShop\Factory::clear(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 		unset( $this->object, $this->context, $this->aimeos ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	public function testGetName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 		$this->assertEquals( 'Subscription process renew', $this->object->getName() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	public function testGetDescription() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 		$this->assertEquals( 'Renews subscriptions at next date', $this->object->getDescription() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 	public function testRun() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 		$item = $this->getSubscription(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 		$object = $this->getMockBuilder( '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 			->setConstructorArgs( [$this->context, $this->aimeos] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 			->setMethods( ['createOrderBase', 'createOrderInvoice', 'createPayment'] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 			->getMock(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 			->setConstructorArgs( [$this->context] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 			->setMethods( ['searchItems', 'saveItem'] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 			->getMock(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 		$object->expects( $this->once() )->method( 'createOrderBase' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 			->will( $this->returnValue( $this->getOrderBaseItem( $item->getOrderBaseId() ) ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 		$object->expects( $this->once() )->method( 'createOrderInvoice' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 			->will( $this->returnValue( $this->getOrderItem() ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 		$object->expects( $this->once() )->method( 'createPayment' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 		$managerStub->expects( $this->once() )->method( 'searchItems' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 			->will( $this->returnValue( [$item] ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 		$managerStub->expects( $this->once() )->method( 'saveItem' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 		$object->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	public function testRunException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 			->setConstructorArgs( [$this->context] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 			->setMethods( ['searchItems', 'saveItem'] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 			->getMock(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 		$managerStub->expects( $this->once() )->method( 'searchItems' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 			->will( $this->returnValue( [$managerStub->createItem()] ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 		$managerStub->expects( $this->never() )->method( 'saveItem' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 		$this->object->run(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | 	public function testAddBasketAddresses() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 		$basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 		$address = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/address' )->createItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 		$addresses = ['payment' => $address]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 		$basket = $this->access( 'addBasketAddresses' )->invokeArgs( $this->object, [$this->context, $basket, $addresses] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 		$this->assertEquals( 1, count( $basket->getAddresses() ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 		$this->assertInstanceOf( \Aimeos\MShop\Order\Item\Base\Address\Iface::class, $basket->getAddress( 'payment' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 	public function testAddBasketCoupons() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 		$this->context->getConfig()->set( 'controller/jobs/subcription/process/renew/standard/use-coupons', true ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 		$basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 		$product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC', ['price'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 		$orderProduct = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' )->createItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 		$price = $product->getRefItems( 'price', 'default', 'default' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 		$basket->addProduct( $orderProduct->copyFrom( $product )->setPrice( reset( $price ) ) ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 		$this->assertEquals( '600.00', $basket->getPrice()->getValue() ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 		$this->assertEquals( '30.00', $basket->getPrice()->getCosts() ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 		$this->assertEquals( '0.00', $basket->getPrice()->getRebate() ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 		$basket = $this->access( 'addBasketCoupons' )->invokeArgs( $this->object, [$this->context, $basket, ['90AB']] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 		$this->assertEquals( 1, count( $basket->getCoupons() ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 		$this->assertEquals( 2, count( $basket->getProducts() ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 		$this->assertEquals( '537.00', $basket->getPrice()->getValue() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 		$this->assertEquals( '30.00', $basket->getPrice()->getCosts() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 		$this->assertEquals( '63.00', $basket->getPrice()->getRebate() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | 	public function testAddBasketProducts() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 		$basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 		$product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 		$orderProducts = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 			$manager->createItem()->copyFrom( $product )->setId( 1 ), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 			$manager->createItem()->copyFrom( $product )->setId( 2 ), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 		$basket = $this->access( 'addBasketProducts' )->invokeArgs( $this->object, [$this->context, $basket, $orderProducts, 1] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 		$this->assertEquals( 1, count( $basket->getProducts() ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 		$this->assertNull( $basket->getProduct( 0 )->getId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 	public function testAddBasketServices() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 		$basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/service' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 		$orderServices = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 			'delivery' => [$manager->createItem()->setCode( 'shiptest' )], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 			'payment' => [$manager->createItem()->setCode( 'paytest' )], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 		$basket = $this->access( 'addBasketServices' )->invokeArgs( $this->object, [$this->context, $basket, $orderServices] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 		$class = \Aimeos\MShop\Order\Item\Base\Service\Iface::class; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 		$this->assertEquals( 2, count( $basket->getServices() ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 		$this->assertEquals( 1, count( $basket->getService( 'delivery' ) ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 		$this->assertInstanceOf( $class, $basket->getService( 'delivery', 'unitcode' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 		$this->assertEquals( 1, count( $basket->getService( 'payment' ) ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 		$this->assertInstanceOf( $class, $basket->getService( 'payment', 'paytest' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 182 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 183 |  |  | 	public function testCreateOrderBase() | 
            
                                                                        
                            
            
                                    
            
            
                | 184 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 185 |  |  | 		$item = $this->getSubscription(); | 
            
                                                                        
                            
            
                                    
            
            
                | 186 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 187 |  |  | 		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' ) | 
            
                                                                        
                            
            
                                    
            
            
                | 188 |  |  | 			->setConstructorArgs( [$this->context] ) | 
            
                                                                        
                            
            
                                    
            
            
                | 189 |  |  | 			->setMethods( ['store'] ) | 
            
                                                                        
                            
            
                                    
            
            
                | 190 |  |  | 			->getMock(); | 
            
                                                                        
                            
            
                                    
            
            
                | 191 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 192 |  |  | 		\Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $managerStub ); | 
            
                                                                        
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 194 |  |  | 		$managerStub->expects( $this->once() )->method( 'store' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 195 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 196 |  |  | 		$this->access( 'createOrderBase' )->invokeArgs( $this->object, [$this->context, $item] ); | 
            
                                                                        
                            
            
                                    
            
            
                | 197 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 	public function testCreateOrderInvoice() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | 		$item = $this->getSubscription(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 		$baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 			->setConstructorArgs( [$this->context] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 			->setMethods( ['saveItem'] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 			->getMock(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $managerStub ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 		$managerStub->expects( $this->once() )->method( 'saveItem' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 		$this->access( 'createOrderInvoice' )->invokeArgs( $this->object, [$this->context, $baseItem] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 	public function testCreatePayment() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 		$item = $this->getSubscription(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 		$invoice = $this->getOrderItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 		$baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  | 		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 			->setConstructorArgs( [$this->context] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 			->setMethods( ['saveItem'] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 			->getMock(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $managerStub ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 		$managerStub->expects( $this->once() )->method( 'saveItem' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  | 		$this->access( 'createPayment' )->invokeArgs( $this->object, [$this->context, $baseItem, $invoice] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 	protected function getOrderItem() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 		return \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 	protected function getOrderBaseItem( $baseId ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  | 		return \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->getItem( $baseId, ['order/base/service'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | 	protected function getSubscription() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 		$search = $manager->createSearch(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  | 		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 		$items = $manager->searchItems( $search ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  | 		if( ( $item = reset( $items ) ) !== false ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 			return $item; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  | 		throw new \Exception( 'No subscription item found' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  | 	protected function access( $name ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | 		$class = new \ReflectionClass( \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard::class ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  | 		$method = $class->getMethod( $name ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | 		$method->setAccessible( true ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | 		return $method; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 274 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 275 |  |  |  | 
            
                        
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.