/** * @inheritdoc */ public function setUp() { $this->data = ['framework' => 'Framework', 'id' => 'upstream_id', 'name' => 'Upstream Name']; $this->session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $this->user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock(); $this->upstreams = $this->getMockBuilder(Upstreams::class)->disableOriginalConstructor()->getMock(); $this->upstream = $this->getMockBuilder(Upstream::class)->disableOriginalConstructor()->getMock(); $this->session->expects($this->once())->method('getUser')->with()->willReturn($this->user); $this->user->expects($this->once())->method('getUpstreams')->with()->willReturn($this->upstreams); $this->upstream->expects($this->any())->method('serialize')->with()->willReturn($this->data); }
/** * @inheritdoc */ protected function setUp() { parent::setUp(); $this->aliases = '//Aliases'; $this->session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $this->user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock(); $this->session->expects($this->once())->method('getUser')->with()->willReturn($this->user); $this->user->expects($this->once())->method('getAliases')->with()->willReturn($this->aliases); $this->command = new AliasesCommand($this->getConfig()); $this->command->setLogger($this->logger); $this->command->setSession($this->session); }
/** * @inheritdoc */ protected function setUp() { parent::setUp(); $this->session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $this->user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock(); $this->payment_methods = $this->getMockBuilder(PaymentMethods::class)->disableOriginalConstructor()->getMock(); $this->session->expects($this->once())->method('getUser')->with()->willReturn($this->user); $this->user->expects($this->once())->method('getPaymentMethods')->with()->willReturn($this->payment_methods); $this->payment_methods->expects($this->once())->method('fetch')->with()->willReturn($this->payment_methods); $this->command = new ListCommand($this->getConfig()); $this->command->setSession($this->session); $this->command->setLogger($this->logger); }
/** * @inheritdoc */ protected function setUp() { parent::setUp(); $this->session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $this->user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock(); $this->upstreams = $this->getMockBuilder(Upstreams::class)->disableOriginalConstructor()->getMock(); $this->upstream = $this->getMockBuilder(Upstream::class)->disableOriginalConstructor()->getMock(); $this->upstream->id = 'upstream_id'; $this->session->expects($this->once())->method('getUser')->with()->willReturn($this->user); $this->user->expects($this->once())->method('getUpstreams')->with()->willReturn($this->upstreams); $this->upstreams->expects($this->once())->method('get')->willReturn($this->upstream); $this->command = new CreateCommand($this->getConfig()); $this->command->setSites($this->sites); $this->command->setLogger($this->logger); $this->command->setSession($this->session); }
/** * Exercises site:list of either membership type owned by a user is the logged-in user */ public function testListMyOwn() { $user_id = 'user_id'; $dummy_info = ['name' => 'my-site', 'id' => 'site_id', 'service_level' => 'pro', 'framework' => 'cms', 'owner' => $user_id, 'created' => '1984-07-28 16:40', 'memberships' => 'org_id: org_url']; $user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock(); $user->id = $user_id; $this->site->memberships = ['org_id: org_url']; $this->sites->expects($this->once())->method('fetch')->with($this->equalTo(['org_id' => null, 'team_only' => false]))->willReturn($this->sites); $this->sites->expects($this->never())->method('filterByName'); $this->session->expects($this->once())->method('getUser')->with()->willReturn($user); $this->sites->expects($this->once())->method('filterByOwner')->with($this->equalTo($user_id))->willReturn($this->sites); $this->site->expects($this->any())->method('serialize')->with()->willReturn($dummy_info); $this->sites->expects($this->once())->method('all')->with()->willReturn([$this->site, $this->site]); $this->logger->expects($this->never())->method('log'); $out = $this->command->index(['team' => false, 'owner' => 'me', 'org' => null, 'name' => null]); $this->assertInstanceOf(RowsOfFields::class, $out); $this->assertEquals([$dummy_info, $dummy_info], $out->getArrayCopy()); }