Skip to content

Commit 4058ff1

Browse files
brynarywfleming
authored andcommitted
Add spec for PHP imports that should not be considered duplicaton
1 parent c55bdd7 commit 4058ff1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Diff for: spec/cc/engine/analyzers/php/main_spec.rb

+31
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,37 @@
163163
"lines" => { "begin" => 11, "end" => 16 },
164164
})
165165
end
166+
167+
it "ignores namespace and use declarations" do
168+
create_source_file("foo.php", <<-EOF)
169+
<?php
170+
namespace KeepClear\\Http\\Controllers\\API\\V1;
171+
use Illuminate\\Http\\Request;
172+
use KeepClear\\Http\\Controllers\\Controller;
173+
use KeepClear\\Models\\Comment;
174+
use KeepClear\\Models\\User;
175+
use KeepClear\\Models\\Asset;
176+
use KeepClear\\Traits\\Controllers\\ApiFilter;
177+
use KeepClear\\Traits\\Controllers\\ApiParseBody;
178+
use KeepClear\\Traits\\Controllers\\ApiException;
179+
EOF
180+
181+
create_source_file("bar.php", <<-EOF)
182+
<?php
183+
namespace KeepClear\\Http\\Controllers\\API\\V1;
184+
use Illuminate\\Http\\Request;
185+
use KeepClear\\Http\\Controllers\\Controller;
186+
use KeepClear\\Models\\Comment;
187+
use KeepClear\\Models\\User;
188+
use KeepClear\\Models\\Asset;
189+
use KeepClear\\Traits\\Controllers\\ApiFilter;
190+
use KeepClear\\Traits\\Controllers\\ApiParseBody;
191+
use KeepClear\\Traits\\Controllers\\ApiException;
192+
EOF
193+
194+
issues = run_engine(engine_conf).strip.split("\0")
195+
expect(issues).to be_empty
196+
end
166197
end
167198

168199
def engine_conf

0 commit comments

Comments
 (0)