2022-02-23 15:58:18 +00:00
|
|
|
<?php declare(strict_types=1);
|
2013-05-27 08:41:50 +00:00
|
|
|
|
2012-03-09 18:30:37 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Composer.
|
|
|
|
*
|
|
|
|
* (c) Nils Adermann <naderman@naderman.de>
|
|
|
|
* Jordi Boggiano <j.boggiano@seld.be>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Composer\Test;
|
|
|
|
|
|
|
|
use Composer\Composer;
|
|
|
|
|
|
|
|
class ComposerTest extends TestCase
|
|
|
|
{
|
2022-02-18 09:38:54 +00:00
|
|
|
public function testSetGetPackage(): void
|
2012-03-09 18:30:37 +00:00
|
|
|
{
|
|
|
|
$composer = new Composer();
|
2018-04-12 08:24:56 +00:00
|
|
|
$package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock();
|
2012-03-09 18:30:37 +00:00
|
|
|
$composer->setPackage($package);
|
|
|
|
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertSame($package, $composer->getPackage());
|
2012-03-09 18:30:37 +00:00
|
|
|
}
|
|
|
|
|
2022-02-18 09:38:54 +00:00
|
|
|
public function testSetGetLocker(): void
|
2012-03-09 18:30:37 +00:00
|
|
|
{
|
|
|
|
$composer = new Composer();
|
|
|
|
$locker = $this->getMockBuilder('Composer\Package\Locker')->disableOriginalConstructor()->getMock();
|
|
|
|
$composer->setLocker($locker);
|
|
|
|
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertSame($locker, $composer->getLocker());
|
2012-03-09 18:30:37 +00:00
|
|
|
}
|
|
|
|
|
2022-02-18 09:38:54 +00:00
|
|
|
public function testSetGetRepositoryManager(): void
|
2012-03-09 18:30:37 +00:00
|
|
|
{
|
|
|
|
$composer = new Composer();
|
|
|
|
$manager = $this->getMockBuilder('Composer\Repository\RepositoryManager')->disableOriginalConstructor()->getMock();
|
|
|
|
$composer->setRepositoryManager($manager);
|
|
|
|
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertSame($manager, $composer->getRepositoryManager());
|
2012-03-09 18:30:37 +00:00
|
|
|
}
|
|
|
|
|
2022-02-18 09:38:54 +00:00
|
|
|
public function testSetGetDownloadManager(): void
|
2012-03-09 18:30:37 +00:00
|
|
|
{
|
|
|
|
$composer = new Composer();
|
2018-04-12 08:24:56 +00:00
|
|
|
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
2022-08-17 12:20:07 +00:00
|
|
|
$manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')->setConstructorArgs([$io])->getMock();
|
2012-03-09 18:30:37 +00:00
|
|
|
$composer->setDownloadManager($manager);
|
|
|
|
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertSame($manager, $composer->getDownloadManager());
|
2012-03-09 18:30:37 +00:00
|
|
|
}
|
|
|
|
|
2022-02-18 09:38:54 +00:00
|
|
|
public function testSetGetInstallationManager(): void
|
2012-03-09 18:30:37 +00:00
|
|
|
{
|
|
|
|
$composer = new Composer();
|
2019-01-17 16:12:33 +00:00
|
|
|
$manager = $this->getMockBuilder('Composer\Installer\InstallationManager')->disableOriginalConstructor()->getMock();
|
2012-03-09 18:30:37 +00:00
|
|
|
$composer->setInstallationManager($manager);
|
|
|
|
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertSame($manager, $composer->getInstallationManager());
|
2012-03-09 18:30:37 +00:00
|
|
|
}
|
2012-06-14 10:10:01 +00:00
|
|
|
}
|