public function testGetPersistableIdAndGetUserId() { $user = new EloquentUser(); $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('1', $user->getPersistableId()); $this->assertEquals('1', $user->getUserId()); }