Skip to content

Commit 949f09b

Browse files
committed
added first ContextResolver specs
1 parent 1c2d7fd commit 949f09b

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
use Complete\Resolver\ContextResolver;
4+
use Parser\ErrorFreePhpParser;
5+
use PhpParser\Lexer;
6+
use Entity\Completion\Context;
7+
8+
describe('ContextResolver', function(){
9+
beforeEach(function(){
10+
$this->parser = new ErrorFreePhpParser(new Lexer);
11+
$this->resolver = new ContextResolver($this->parser);
12+
$this->dummyLine = '$obj->getMethod()->';
13+
});
14+
describe('getContext()', function(){
15+
it('throws exception on empty line', function(){
16+
expect(function($l){ $this->resolver->getContext($l); })->with('')->to->throw('Exception');
17+
});
18+
it('returns Context instance', function(){
19+
$result = $this->resolver->getContext($this->dummyLine);
20+
expect($result)->to->be->an->instanceof(Context::class);
21+
});
22+
});
23+
});

0 commit comments

Comments
 (0)