@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__DIR__, 2).'/scripts/lib/SgfWorkflowExtension.php';
|
||||
|
||||
test('workflow namespace transfer preserves rule strings comments and SQL', function () {
|
||||
$source = <<<'PHP'
|
||||
<?php
|
||||
namespace App\Services;
|
||||
use App\Models\User;
|
||||
// App\Models\User is a comment, not a PHP name token.
|
||||
final class Example {
|
||||
public function run(\App\Models\User $user): string {
|
||||
$literal = 'App\Models\User';
|
||||
$sql = "SELECT 'App\\Models\\User'";
|
||||
return $literal;
|
||||
}
|
||||
}
|
||||
PHP;
|
||||
$output = SgfWorkflowExtension::transform($source);
|
||||
expect($output)->toContain('namespace Tempo\Purchasing\Embedded\Services;')
|
||||
->toContain('use Tempo\Purchasing\Embedded\Models\User;')
|
||||
->toContain('run(\Tempo\Purchasing\Embedded\Models\User $user)')
|
||||
->toContain("'App\\Models\\User'")->toContain('// App\Models\User is a comment')
|
||||
->toContain('SELECT \'App\\\\Models\\\\User\'');
|
||||
});
|
||||
Reference in New Issue
Block a user