예제 #1
0
 public function testGetUserLogin()
 {
     $user = new EloquentUser();
     $user->email = '*****@*****.**';
     $user->setConnectionResolver($resolver = m::mock('Illuminate\\Database\\ConnectionResolverInterface'));
     $resolver->shouldReceive('connection')->andReturn(m::mock('Illuminate\\Database\\Connection'));
     $user->getConnection()->shouldReceive('getQueryGrammar')->andReturn(m::mock('Illuminate\\Database\\Query\\Grammars\\Grammar'));
     $user->getConnection()->shouldReceive('getPostProcessor')->andReturn($processor = m::mock('Illuminate\\Database\\Query\\Processors\\Processor'));
     $user->getConnection()->getQueryGrammar()->shouldReceive('getDateFormat')->andReturn('Y-m-d H:i:s');
     $user->getConnection()->getQueryGrammar()->shouldReceive('compileInsertGetId');
     $processor->shouldReceive('processInsertGetId')->andReturn(1);
     $user->save();
     $this->assertEquals('*****@*****.**', $user->getUserLogin());
 }