@@ -68,17 +68,17 @@ public function tearDown() {
68
68
* @return void
69
69
*/
70
70
public function testConfig () {
71
- $ this ->assertEquals ([], TableRegistry::config ('Test ' ));
71
+ $ this ->assertEquals ([], TableRegistry::config ('Tests ' ));
72
72
73
73
$ data = [
74
74
'connection ' => 'testing ' ,
75
75
'entityClass ' => 'TestApp\Model\Entity\Article ' ,
76
76
];
77
- $ result = TableRegistry::config ('Test ' , $ data );
77
+ $ result = TableRegistry::config ('Tests ' , $ data );
78
78
$ this ->assertEquals ($ data , $ result , 'Returns config data. ' );
79
79
80
80
$ result = TableRegistry::config ();
81
- $ expected = ['Test ' => $ data ];
81
+ $ expected = ['Tests ' => $ data ];
82
82
$ this ->assertEquals ($ expected , $ result );
83
83
}
84
84
@@ -88,13 +88,13 @@ public function testConfig() {
88
88
* @return void
89
89
*/
90
90
public function testGet () {
91
- $ result = TableRegistry::get ('Article ' , [
91
+ $ result = TableRegistry::get ('Articles ' , [
92
92
'table ' => 'my_articles ' ,
93
93
]);
94
94
$ this ->assertInstanceOf ('Cake\ORM\Table ' , $ result );
95
95
$ this ->assertEquals ('my_articles ' , $ result ->table ());
96
96
97
- $ result2 = TableRegistry::get ('Article ' , [
97
+ $ result2 = TableRegistry::get ('Articles ' , [
98
98
'table ' => 'herp_derp ' ,
99
99
]);
100
100
$ this ->assertSame ($ result , $ result2 );
@@ -107,10 +107,10 @@ public function testGet() {
107
107
* @return void
108
108
*/
109
109
public function testGetWithConfig () {
110
- TableRegistry::config ('Article ' , [
110
+ TableRegistry::config ('Articles ' , [
111
111
'table ' => 'my_articles ' ,
112
112
]);
113
- $ result = TableRegistry::get ('Article ' );
113
+ $ result = TableRegistry::get ('Articles ' );
114
114
$ this ->assertEquals ('my_articles ' , $ result ->table (), 'Should use config() data. ' );
115
115
}
116
116
@@ -121,26 +121,26 @@ public function testGetWithConfig() {
121
121
* @return void
122
122
*/
123
123
public function testBuildConvention () {
124
- $ table = TableRegistry::get ('article ' );
125
- $ this ->assertInstanceOf ('\TestApp\Model\Repository\ArticleTable ' , $ table );
126
- $ table = TableRegistry::get ('Article ' );
127
- $ this ->assertInstanceOf ('\TestApp\Model\Repository\ArticleTable ' , $ table );
124
+ $ table = TableRegistry::get ('articles ' );
125
+ $ this ->assertInstanceOf ('\TestApp\Model\Repository\ArticlesTable ' , $ table );
126
+ $ table = TableRegistry::get ('Articles ' );
127
+ $ this ->assertInstanceOf ('\TestApp\Model\Repository\ArticlesTable ' , $ table );
128
128
129
- $ table = TableRegistry::get ('author ' );
130
- $ this ->assertInstanceOf ('\TestApp\Model\Repository\AuthorTable ' , $ table );
131
- $ table = TableRegistry::get ('Author ' );
132
- $ this ->assertInstanceOf ('\TestApp\Model\Repository\AuthorTable ' , $ table );
129
+ $ table = TableRegistry::get ('authors ' );
130
+ $ this ->assertInstanceOf ('\TestApp\Model\Repository\AuthorsTable ' , $ table );
131
+ $ table = TableRegistry::get ('Authors ' );
132
+ $ this ->assertInstanceOf ('\TestApp\Model\Repository\AuthorsTable ' , $ table );
133
133
134
134
$ class = $ this ->getMockClass ('\Cake\ORM\Table ' );
135
135
$ class ::staticExpects ($ this ->once ())
136
136
->method ('defaultConnectionName ' )
137
137
->will ($ this ->returnValue ('test ' ));
138
138
139
- if (!class_exists ('MyPlugin\Model\Repository\SuperTestTable ' )) {
140
- class_alias ($ class , 'MyPlugin\Model\Repository\SuperTestTable ' );
139
+ if (!class_exists ('MyPlugin\Model\Repository\SuperTestsTable ' )) {
140
+ class_alias ($ class , 'MyPlugin\Model\Repository\SuperTestsTable ' );
141
141
}
142
142
143
- $ table = TableRegistry::get ('MyPlugin.SuperTest ' );
143
+ $ table = TableRegistry::get ('MyPlugin.SuperTests ' );
144
144
$ this ->assertInstanceOf ($ class , $ table );
145
145
}
146
146
@@ -192,8 +192,8 @@ public function testConfigAndBuild() {
192
192
*/
193
193
public function testSet () {
194
194
$ mock = $ this ->getMock ('Cake\ORM\Table ' );
195
- $ this ->assertSame ($ mock , TableRegistry::set ('Article ' , $ mock ));
196
- $ this ->assertSame ($ mock , TableRegistry::get ('Article ' ));
195
+ $ this ->assertSame ($ mock , TableRegistry::set ('Articles ' , $ mock ));
196
+ $ this ->assertSame ($ mock , TableRegistry::get ('Articles ' ));
197
197
}
198
198
199
199
}
0 commit comments