-
Notifications
You must be signed in to change notification settings - Fork 0
/
transunit.php
36 lines (25 loc) · 1.13 KB
/
transunit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;
(new SingleCommandApplication())
->setName('Transunit')
->addArgument('source', InputArgument::REQUIRED, 'Location of PhpSpec tests to convert.')
->addArgument('destination', InputArgument::REQUIRED, 'Export directory for converted PHPUnit test.')
->setCode(function (InputInterface $input, OutputInterface $output): int {
$fs = new \Symfony\Component\Filesystem\Filesystem();
$source = $input->getArgument('source');
$destination = $input->getArgument('destination');
if (!$fs->isAbsolutePath($source)) {
$source = getcwd().'/'.$source;
}
if (!$fs->isAbsolutePath($destination)) {
$destination = getcwd().'/'.$destination;
}
\Transunit\Transunit::create()->run($source, $destination);
return Command::SUCCESS;
})
->run();