1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

[Tests] Use static data providers (#11197)

This commit is contained in:
Ion Bazan 2022-11-24 21:39:08 +08:00 committed by GitHub
parent 0cf57255d4
commit 8ff237afb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 715 additions and 723 deletions

View file

@ -36,12 +36,12 @@ class SvnTest extends TestCase
$this->assertEquals($expect, $reflMethod->invoke($svn));
}
public function urlProvider(): array
public static function urlProvider(): array
{
return [
['http://till:test@svn.example.org/', $this->getCmd(" --username 'till' --password 'test' ")],
['http://till:test@svn.example.org/', self::getCmd(" --username 'till' --password 'test' ")],
['http://svn.apache.org/', ''],
['svn://johndoe@example.org', $this->getCmd(" --username 'johndoe' --password '' ")],
['svn://johndoe@example.org', self::getCmd(" --username 'johndoe' --password '' ")],
];
}
@ -54,7 +54,7 @@ class SvnTest extends TestCase
$reflMethod->setAccessible(true);
$this->assertEquals(
$this->getCmd("svn ls --non-interactive -- 'http://svn.example.org'"),
self::getCmd("svn ls --non-interactive -- 'http://svn.example.org'"),
$reflMethod->invokeArgs($svn, ['svn ls', $url])
);
}
@ -76,7 +76,7 @@ class SvnTest extends TestCase
$reflMethod = new \ReflectionMethod('Composer\\Util\\Svn', 'getCredentialString');
$reflMethod->setAccessible(true);
$this->assertEquals($this->getCmd(" --username 'foo' --password 'bar' "), $reflMethod->invoke($svn));
$this->assertEquals(self::getCmd(" --username 'foo' --password 'bar' "), $reflMethod->invoke($svn));
}
public function testCredentialsFromConfigWithCacheCredentialsTrue(): void
@ -99,7 +99,7 @@ class SvnTest extends TestCase
$reflMethod = new \ReflectionMethod('Composer\\Util\\Svn', 'getCredentialString');
$reflMethod->setAccessible(true);
$this->assertEquals($this->getCmd(" --username 'foo' --password 'bar' "), $reflMethod->invoke($svn));
$this->assertEquals(self::getCmd(" --username 'foo' --password 'bar' "), $reflMethod->invoke($svn));
}
public function testCredentialsFromConfigWithCacheCredentialsFalse(): void
@ -122,6 +122,6 @@ class SvnTest extends TestCase
$reflMethod = new \ReflectionMethod('Composer\\Util\\Svn', 'getCredentialString');
$reflMethod->setAccessible(true);
$this->assertEquals($this->getCmd(" --no-auth-cache --username 'foo' --password 'bar' "), $reflMethod->invoke($svn));
$this->assertEquals(self::getCmd(" --no-auth-cache --username 'foo' --password 'bar' "), $reflMethod->invoke($svn));
}
}