File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,15 @@ public function createSpace($space, $properties = null)
3838    public  function  formatValue ($ type$ value
3939    {
4040        switch ($ type
41-             case  'str ' : return  (string ) $ value
42-             case  'unsigned ' : return  (int ) $ value
41+             case  'STR ' :
42+             case  'str ' :
43+                 return  (string ) $ value
44+ 
45+             case  'unsigned ' :
46+             case  'UNSIGNED ' :
47+             case  'num ' :
48+             case  'NUM ' :
49+                 return  (int ) $ value
4350            default : return  $ value
4451        }
4552    }
Original file line number Diff line number Diff line change 77
88class  MapperTest extends  TestCase
99{
10+     public  function  testTypesCasting ()
11+     {
12+         $ mapper$ this createMapper ();
13+         $ this clean ($ mapper
14+ 
15+         $ mappergetSchema ()
16+             ->createSpace ('tester ' , [
17+                 'id '  => 'unsigned ' ,
18+                 'name '  => 'str ' ,
19+             ])
20+             ->addIndex ('id ' )
21+             ->addIndex ('name ' );
22+ 
23+         $ petya$ mappercreate ('tester ' , [
24+             'id '  => '1 ' ,
25+             'name '  => 'petya ' ,
26+         ]);
27+         $ this assertSame (1 , $ petyaid );
28+ 
29+         $ anotherPetya$ mapperfindOne ('tester ' , ['id '  => '1 ' ]);
30+         $ this assertNotNull ($ anotherPetya
31+     }
1032    public  function  testIndexRemoved ()
1133    {
1234        $ mapper$ this createMapper ();
@@ -33,7 +55,7 @@ public function testIndexRemoved()
3355        $ this assertNotNull ($ mapperfindOne ('tester ' , ['name2 '  => 'w ' ]));
3456    }
3557
36-     public  function  testCasting ()
58+     public  function  testPropertyNameCasting ()
3759    {
3860        $ mapper$ this createMapper ();
3961        $ this clean ($ mapper
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments