2022-06-06 08:48:42 +00:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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\Command;
|
|
|
|
|
|
|
|
use Composer\Test\TestCase;
|
|
|
|
|
|
|
|
class DiagnoseCommandTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testCmdFail(): void
|
|
|
|
{
|
|
|
|
$this->initTempComposer(['name' => 'foo/bar', 'description' => 'test pkg']);
|
|
|
|
|
|
|
|
$appTester = $this->getApplicationTester();
|
|
|
|
$appTester->run(['command' => 'diagnose']);
|
|
|
|
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertSame(1, $appTester->getStatusCode());
|
2022-06-06 08:48:42 +00:00
|
|
|
|
|
|
|
$output = $appTester->getDisplay(true);
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertStringContainsString('Checking composer.json: <warning>WARNING</warning>
|
2022-06-06 08:48:42 +00:00
|
|
|
<warning>No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.</warning>', $output);
|
|
|
|
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertStringContainsString('Checking http connectivity to packagist: OK
|
2022-06-06 08:48:42 +00:00
|
|
|
Checking https connectivity to packagist: OK
|
2022-06-06 15:01:31 +00:00
|
|
|
Checking github.com rate limit: ', $output);
|
2022-06-06 08:48:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testCmdSuccess(): void
|
|
|
|
{
|
|
|
|
$this->initTempComposer(['name' => 'foo/bar', 'description' => 'test pkg', 'license' => 'MIT']);
|
|
|
|
|
|
|
|
$appTester = $this->getApplicationTester();
|
|
|
|
$appTester->run(['command' => 'diagnose']);
|
|
|
|
|
|
|
|
$appTester->assertCommandIsSuccessful();
|
|
|
|
|
|
|
|
$output = $appTester->getDisplay(true);
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertStringContainsString('Checking composer.json: OK', $output);
|
2022-06-06 08:48:42 +00:00
|
|
|
|
2024-05-29 21:12:06 +00:00
|
|
|
self::assertStringContainsString('Checking http connectivity to packagist: OK
|
2022-06-06 08:48:42 +00:00
|
|
|
Checking https connectivity to packagist: OK
|
2022-06-06 15:01:31 +00:00
|
|
|
Checking github.com rate limit: ', $output);
|
2022-06-06 08:48:42 +00:00
|
|
|
}
|
|
|
|
}
|