/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $this->ssh_keys = $this->getMockBuilder(SSHKeys::class)->disableOriginalConstructor()->getMock(); $this->user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock(); $this->user->expects($this->any())->method('getSSHKeys')->willReturn($this->ssh_keys); $this->session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $this->session->method('getUser')->willReturn($this->user); }
/** * Tests the multidev:list command when there are no multidev environments */ public function testOrgListNotEmpty() { $data = ['id' => 'org_id', 'name' => 'Organization Name']; $this->user->expects($this->once())->method('getOrganizations')->with()->willReturn([$this->organization, $this->organization]); $this->logger->expects($this->never())->method('log'); $this->organization->expects($this->exactly(2))->method('serialize')->with()->willReturn($data); $out = $this->command->listOrgs(); $this->assertInstanceOf('Consolidation\\OutputFormatters\\StructuredData\\RowsOfFields', $out); $this->assertEquals([$data, $data], $out->getArrayCopy()); }
/** * @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->user_org_memberships = $this->getMockBuilder(UserOrganizationMemberships::class)->disableOriginalConstructor()->getMock(); $this->user_org_membership = $this->getMockBuilder(UserOrganizationMembership::class)->disableOriginalConstructor()->getMock(); $this->organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock(); $this->organization->id = 'org_id'; $this->session->method('getUser')->with()->willReturn($this->user); $this->user->method('getOrgMemberships')->with()->willReturn($this->user_org_memberships); $this->user_org_memberships->method('get')->with($this->equalTo($this->organization->id))->willReturn($this->user_org_membership); $this->user_org_membership->method('getOrganization')->with()->willReturn($this->organization); }
/** * @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); }
public function testGetName() { $this->assertEquals($this->user_data['profile']->full_name, $this->user->getName()); }