mirror of
https://github.com/laravel/valet.git
synced 2026-02-04 00:10:07 +01:00
* First attempt at testing CLI commands * Apply fixes from StyleCI * Protect from running locally * Fix test * wip * wip * wip * wip * wip * Update app.php * Create config folder and files for CLI tests * Apply fixes from StyleCI * Fix some formatting * Fix imports * Update all output() calls to use the writer passed in by the command Ugly capture of all $outputs from commands, by passing them into `writer()` to be bound into the container, where they can then be pulled out from calls to `output()` and its buddies `info()`, `table()`, and `warning()`. * Apply fixes from StyleCI * Flesh out park command test * Apply fixes from StyleCI * Drop php 7.0 and 7.1 Co-authored-by: StyleCI Bot <bot@styleci.io> Co-authored-by: Matt Stauffer <matt@tighten.co>
32 lines
852 B
PHP
32 lines
852 B
PHP
<?php
|
|
|
|
use Valet\Filesystem;
|
|
|
|
class FilesystemTest extends Yoast\PHPUnitPolyfills\TestCases\TestCase
|
|
{
|
|
use UsesNullWriter;
|
|
|
|
public function set_up()
|
|
{
|
|
$this->setNullWriter();
|
|
}
|
|
|
|
public function tear_down()
|
|
{
|
|
exec('rm -rf '.__DIR__.'/output');
|
|
mkdir(__DIR__.'/output');
|
|
touch(__DIR__.'/output/.gitkeep');
|
|
}
|
|
|
|
public function test_remove_broken_links_removes_broken_symlinks()
|
|
{
|
|
$files = new Filesystem;
|
|
file_put_contents(__DIR__.'/output/file.out', 'test');
|
|
symlink(__DIR__.'/output/file.out', __DIR__.'/output/file.link');
|
|
$this->assertFileExists(__DIR__.'/output/file.link');
|
|
unlink(__DIR__.'/output/file.out');
|
|
$files->removeBrokenLinksAt(__DIR__.'/output');
|
|
$this->assertFileDoesNotExist(__DIR__.'/output/file.link');
|
|
}
|
|
}
|