Esempio n. 1
0
 public function testgetAuthentications()
 {
     $io = new NullIO();
     $this->assertInternalType('array', $io->getAuthentications());
     $this->assertEmpty($io->getAuthentications());
     $this->assertEquals(array('username' => null, 'password' => null), $io->getAuthentication('foo'));
 }
 public function testConstruct()
 {
     $io = new IO\NullIO();
     $req = new HttpGetRequest('packagist.org', 'https://packagist.org/packages.json', $io);
     self::assertSame('https', $req->scheme);
     self::assertSame('packagist.org', $req->origin);
     self::assertSame('packagist.org', $req->host);
     self::assertSame('/packages.json', $req->path);
     self::assertSame(array(), $req->query);
     $req = new HttpGetRequest('example.com', 'http://*****:*****@example.com:8080/something/path?a=b&c=d', $io);
     self::assertSame(8080, $req->port);
     self::assertSame('user', $req->username);
     self::assertSame('pass', $req->password);
     self::assertEquals(array('a' => 'b', 'c' => 'd'), $req->query);
     self::assertEquals(array('username' => 'user', 'password' => 'pass'), $io->getAuthentication('example.com'));
 }