destinationsFor($path); $this->assertEquals($expectedTargets, $targets); } public function provideTeleport() { yield 'no available targets' => [ [ 'target1' => 'lib/.php', ], 'lib/MyFile.php', [ ], ]; yield 'one available target' => [ [ 'target1' => 'lib/.php', 'target2' => 'tests/Test.php', ], 'lib/MyFile.php', [ 'target2' => 'tests/MyFileTest.php', ], ]; yield 'multiple matching targets' => [ [ 'target1' => 'lib/.php', 'target2' => 'tests/Test.php', 'target3' => 'benchmarks/Bench.php', ], 'lib/MyFile.php', [ 'target2' => 'tests/MyFileTest.php', 'target3' => 'benchmarks/MyFileBench.php', ], ]; yield 'composite path' => [ [ 'target1' => 'lib/.php', 'target2' => 'tests/Test.php', ], 'lib/Foobar/Barfoo/MyFile.php', [ 'target2' => 'tests/Foobar/Barfoo/MyFileTest.php', ], ]; yield 'absolute path' => [ [ 'target1' => 'lib/.php', 'target2' => 'tests/Test.php', ], '/home/daniel/lib/Foobar/Barfoo/MyFile.php', [ 'target2' => 'tests/Foobar/Barfoo/MyFileTest.php', ], ]; yield 'relative path' => [ [ 'target1' => 'lib/.php', 'target2' => 'tests/Test.php', ], '/home/daniel/lib/Foobar/../Foobar/Barfoo/MyFile.php', [ 'target2' => 'tests/Foobar/Barfoo/MyFileTest.php', ], ]; yield 'from unit test' => [ [ 'target1' => 'lib/.php', 'target2' => 'tests/Unit/Test.php', ], 'tests/Unit/MyFileTest.php', [ 'target1' => 'lib/MyFile.php', ], ]; yield 'multiple segments 1' => [ [ 'target1' => 'lib//.php', 'target2' => 'tests//Unit/Test.php', ], 'tests/ModuleOne/Unit/MyFileTest.php', [ 'target1' => 'lib/ModuleOne/MyFile.php', ], ]; yield 'multiple segments 2' => [ [ 'target1' => 'lib//.php', 'target2' => 'tests//Unit/Test.php', ], 'lib/ModuleOne/MyFile.php', [ 'target2' => 'tests/ModuleOne/Unit/MyFileTest.php', ], ]; yield 'multiple segments with containing multiple elements' => [ [ 'target1' => 'lib//.php', 'target2' => 'tests//Unit/Test.php', ], 'lib/ModuleOne/Model/Abstractor/MyFile.php', [ 'target2' => 'tests/ModuleOne/Unit/Model/Abstractor/MyFileTest.php', ], ]; yield 'mixed multiple segments' => [ [ 'target1' => 'lib//.php', 'target2' => 'tests//Unit/Test.php', ], 'lib/ModuleOne/Model/Abstractor/MyFile.php', [ 'target2' => 'tests/Model/Abstractor/MyFile/Unit/ModuleOneTest.php', ], ]; yield 'multiple with missing placeholders' => [ [ 'target1' => 'lib//.php', 'target2' => 'tests/Unit/Test.php', ], 'lib/ModuleOne/Model/Abstractor/MyFile.php', [ 'target2' => 'tests/Unit/Model/Abstractor/MyFileTest.php', ], ]; yield 'multiple with non-correlating placeholders' => [ [ 'target1' => 'lib//.php', 'target2' => 'tests/Unit/Test.php', ], 'lib/ModuleOne/Model/Abstractor/MyFile.php', [ 'target2' => 'tests/Unit/Test.php', ], ]; yield 'one available target with directories with identical name' => [ [ 'target1' => 'src/.php', 'target2' => 'tests/Test.php', ], self::PROJECT_ROOT . '/src/MyFile.php', [ 'target2' => 'tests/MyFileTest.php', ], ]; yield 'jump back to one available target with directories with identical name' => [ [ 'target1' => 'src/.php', 'target2' => 'tests/Test.php', ], self::PROJECT_ROOT . '/tests/MyFileTest.php', [ 'target1' => 'src/MyFile.php', ], ]; } public function testNoMatchingTarget(): void { $this->expectException(NoMatchingSourceException::class); $this->expectExceptionMessage('Could not find matching source pattern for "/lib/Foo.php", known patterns: "/soos//boos.php"'); $teleport = PathFinder::fromDestinations([ 'soos' => '/soos//boos.php', ]); $teleport->destinationsFor('/lib/Foo.php'); } public function testDestinationWithNoKernel(): void { $this->expectException(NoPlaceHoldersException::class); $this->expectExceptionMessage('File pattern "/soos/boos.php" does not contain any '); $teleport = PathFinder::fromDestinations([ 'soos' => '/soos/boos.php', ]); $teleport->destinationsFor('/lib/Foo.php'); } } __halt_compiler();----SIGNATURE:----stukOfBQz18rzGWeYV+dDCgNS2O9rzF1DBD2A99i+FN2t5JZAgKDxsgF05lMCmlbZw/J/hdB3Xwfkl1GVlsqsyc3eQRhhquQiuY1FnbIj5pVHPHoibEiPl7cETtdj7+BLlLG3Y9TeqTnF955+cGDYtccxEbhD7bn9scWgBWSVOrcb2pdnKqPot/ZwH0740fRAIdsMpHyhIvylKqxHyw6xv5inNJyxf142NQGq3L2d9OLZrnB/wXQisQJPETVJ3lGf8yMKxsFhYGcGDSRI58ZvSXTRUWBth+DRJMvR1yyh0Zk6Dd6EQdZGWO9oDQonFQTAL87pzV+A7V4SWO94w7m+cWqrLRb/DCl1FuLiS8ibSngJhyz9+TRz/ur/qf1UGYWEi0sFOGgpne2wfRqOMLZqperIcZpBpNx+doJw1lVaUtLvyYCI3yfATl9aQv6UDn/8ZlT3Hcuf03FTnHBJE1gAwU8/T5j8sR2uu6hZGMOF5qGjhaYJ4rk+IiEhoAPqZxts4tVd5SRayrLcubMpsWlsweOX6qwfYOGvdNjGhuYtD9gPAMIoewKmoYmq+JfXiUDLsw9JMiFcSQfTHqS4Z21Di1TOrqF1kleid7K0dCjqnO3L++DLYvTcRnHsSOc5WfB5Cik3JTCkkFOqAvaC4PbWcYpI6rYv1KyuLA0DqIhSaU=----ATTACHMENT:----NDI2NTc2MDM0Nzg4MDEyOCA1OTYwNDU1MjI4NDg1OTI1IDI4NzM4MzQ3MjQ0NjkwNTU=