public function testRegisterAbstract() { $boundWith = function () { return true; }; $boundWill = function ($serviceName) { switch ($serviceName) { case 'commode.common.loaded': return false; } dd('bound', $serviceName); return true; }; $makeWill = function ($make) { switch ($make) { case 'commode.common.ghostservice': return $this->ghostServices; break; case 'commode.common.resolver': return $this->resolver; break; } dd('make', func_get_args()); }; $this->applicationMock->expects($this->any())->method('getLoadedProviders')->will($this->returnValue([])); $this->applicationMock->expects($this->any())->method('bound')->with($this->callback($boundWith))->will($this->returnCallback($boundWill)); $this->applicationMock->expects($this->any())->method('make')->will($this->returnCallback($makeWill)); $this->ghostService->register(); $this->commonGhostService->register(); }
public function testRegister() { $this->getApplicationMock()->expects($this->atLeastOnce())->method('bound')->with(SilentServiceServiceProvider::PROVIDES_MANAGER)->will($this->returnValue(false)); $this->getApplicationMock()->expects($this->atLeastOnce())->method('register')->with(SilentServiceServiceProvider::class); $this->getApplicationMock()->expects($this->any())->method('make')->will($this->returnCallback(function ($make) { switch ($make) { case SilentServiceServiceProvider::PROVIDES_MANAGER: return $this->silentManager; } })); $this->getApplicationMock()->expects($this->any())->method('getLoadedProviders')->will($this->returnValue([])); list($testAliasKey, $testAliasValue) = [uniqid('Alias'), uniqid('Facade')]; $this->testInstance->expects($this->atLeastOnce())->method('aliases')->will($this->returnValue([$testAliasKey => $testAliasValue])); $this->getApplicationMock()->expects($this->once())->method('booting')->will($this->returnCallback(function (callable $callback) { $callback(); })); /** * @var AliasLoader|Mock $aliasLoaderMock */ $aliasLoaderMock = $this->getMock(AliasLoader::class, [], [[]], ''); AliasLoader::setInstance($aliasLoaderMock); $aliasLoaderMock->setAliases([]); $aliasLoaderMock->expects($this->any())->method('getAliases')->will($this->returnValue([])); $aliasLoaderMock->expects($this->once())->method('alias')->with($testAliasKey, $testAliasValue); $this->testInstance->register(); }
public function testRegistration() { $this->assertFalse($this->filterGroup->isRegistered()); $this->routingMock->expects($this->once())->method('filter'); $this->resolverMock->expects($this->once())->method('methodToClosure'); $this->filterGroup->register($this->routingMock, $this->resolverMock); $this->assertTrue($this->filterGroup->isRegistered()); }
public function testRegister() { $this->orderItemFactoryMock->expects($this->once())->method('create')->willReturn($this->orderItemMock); $this->orderItemMock->expects($this->once())->method('load')->with(1)->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('getQtyInvoiced')->willReturn(1); $this->orderItemMock->expects($this->once())->method('getTaxInvoiced')->willReturn(1); $this->orderItemMock->expects($this->once())->method('getBaseTaxInvoiced')->willReturn(1); $this->orderItemMock->expects($this->once())->method('getDiscountTaxCompensationInvoiced')->willReturn(1); $this->orderItemMock->expects($this->once())->method('getBaseDiscountTaxCompensationInvoiced')->willReturn(1); $this->orderItemMock->expects($this->once())->method('getDiscountInvoiced')->willReturn(1); $this->orderItemMock->expects($this->once())->method('getBaseDiscountInvoiced')->willReturn(1); $this->orderItemMock->expects($this->once())->method('getRowInvoiced')->willReturn(1); $this->orderItemMock->expects($this->once())->method('getBaseRowInvoiced')->willReturn(1); $this->orderItemMock->expects($this->once())->method('setQtyInvoiced')->with(2)->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('setTaxInvoiced')->with(2)->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('setBaseTaxInvoiced')->with(2)->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('setDiscountTaxCompensationInvoiced')->with(2)->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('setBaseDiscountTaxCompensationInvoiced')->with(2)->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('setDiscountInvoiced')->with(2)->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('setBaseDiscountInvoiced')->with(2)->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('setRowInvoiced')->with(2)->willReturnSelf(); $this->orderItemMock->expects($this->once())->method('setBaseRowInvoiced')->with(2)->willReturnSelf(); $this->item->setData(['order_item_id' => 1, 'qty' => 1, 'tax_amount' => 1, 'base_tax_amount' => 1, 'discount_tax_compensation_amount' => 1, 'base_discount_tax_compensation_amount' => 1, 'discount_amount' => 1, 'base_discount_amount' => 1, 'row_total' => 1, 'base_row_total' => 1]); $this->assertEquals($this->item->register(), $this->item); }
public function testRegister() { $this->initJob(); $this->assertNull($this->job->register()); }