zendframework / zend-test

Test component from Zend Framework
BSD 3-Clause "New" or "Revised" License
18 stars 38 forks source link

assertControllerClass vs. assertControllerName => check FQDN instead of class name #67

Closed koseduhemak closed 6 years ago

koseduhemak commented 6 years ago

assertControllerClass does not check FQDN, instead it checks just the same (just the name of the class) as assertControllerName. I know that hypothetically it is possible to have multiple classes in one file, where the both methods can lead to different results, but that is rather an edge case (and bad design).

Code to reproduce the issue

$this->assertControllerClass(Foo\Bar\MyController::class); // error: "not equals mycontroller"
$this->assertControllerName(Foo\Bar\MyController::class); // error: "not equals mycontroller"

Expected results

$this->assertControllerClass(Foo\Bar\MyController::class); // success: "equals foobarmycontroller" (as zend-servicemanager also resolves/normalizes FQDNs)
$this->assertControllerName(Foo\Bar\MyController::class); // error: "not equals mycontroller"

Actual results

assertControllerClass checks only the name of the class (not the FQDN).


I propose to have either a dedicated method assertControllerFqdn or refactor the behavior of the assertControllerClass method and check against the FQDN.

What do you think?

koseduhemak commented 6 years ago

Sorry, I saw that assertControllerName does exactly what I want...