-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Proxy command: skip tables #142 * Proxy command: skip tables #142 * Unit test for ClientBuild #142
- Loading branch information
1 parent
01ac734
commit b6fb892
Showing
4 changed files
with
140 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace admintests\admin\proxy; | ||
|
||
use admintests\AdminTestCase; | ||
use luya\admin\proxy\ClientBuild; | ||
use luya\admin\commands\ProxyController; | ||
|
||
class ClientBuildTest extends AdminTestCase | ||
{ | ||
public function testIsSkippableTable() | ||
{ | ||
$ctrl = new ProxyController('proxyctrl', $this->app); | ||
$build = new ClientBuild($ctrl, [ | ||
'buildConfig' => ['tables' => []], | ||
]); | ||
|
||
$tableFilters = [ | ||
"cms_include_case1" => ["cms_*"], | ||
"cms_include_case2" => ["!admin_*"], | ||
|
||
"cms_include_case3" => ["cms_*", "admin_*"], | ||
"admin_include_case3" => ["cms_*", "admin_*"], | ||
|
||
"cms_include_case4" => ["cms_*", "admin_*"], | ||
"admin_include_case4" => ["cms_*", "admin_*"], | ||
|
||
"cms_include_case5" => ["cms_*", "admin_*", "!cms_*"], | ||
"admin_include_case5" => ["cms_*", "admin_*", "!cms_*"], | ||
]; | ||
|
||
foreach ($tableFilters as $tableName => $filters) { | ||
$this->assertFalse($this->invokeMethod($build, 'isSkippableTable', [$tableName, $filters]), "$tableName should be skippable by filter " . implode(', ', $filters)); | ||
} | ||
} | ||
|
||
public function testIsNotSkippableTable() | ||
{ | ||
$ctrl = new ProxyController('proxyctrl', $this->app); | ||
$build = new ClientBuild($ctrl, [ | ||
'buildConfig' => ['tables' => []], | ||
]); | ||
|
||
$tableFilters = [ | ||
"cms_exclude_case1" => ["!cms_*"], | ||
"cms_exclude_case2" => ["admin_*"], | ||
|
||
"cms_exclude_case3" => ["!cms_*", "!admin_*"], | ||
"admin_exclude_case3" => ["!cms_*", "!admin_*"], | ||
|
||
"cms_exclude_case4" => ["!cms_*", "!admin_*"], | ||
"admin_exclude_case4" => ["!cms_*", "!admin_*"], | ||
|
||
"cms_exclude_case5" => ["!cms_*", "!admin_*", "cms_*"], | ||
"admin_exclude_case5" => ["!cms_*", "!admin_*", "cms_*"], | ||
]; | ||
|
||
foreach ($tableFilters as $tableName => $filters) { | ||
$this->assertTrue($this->invokeMethod($build, 'isSkippableTable', [$tableName, $filters]), "$tableName should not be skippable by filter " . implode(', ', $filters)); | ||
} | ||
} | ||
} |