|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace tests\Happyr\DoctrineSpecification; |
|
4
|
|
|
|
|
5
|
|
|
use Happyr\DoctrineSpecification\Spec; |
|
6
|
|
|
use PhpSpec\ObjectBehavior; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* @mixin Spec |
|
10
|
|
|
*/ |
|
11
|
|
|
class SpecSpec extends ObjectBehavior |
|
12
|
|
|
{ |
|
13
|
|
|
public function it_creates_an_x_specification() |
|
14
|
|
|
{ |
|
15
|
|
|
$this->andX()->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Logic\LogicX'); |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
public function it_creates_add_operand() |
|
19
|
|
|
{ |
|
20
|
|
|
$this->add('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\Addition'); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function it_creates_sub_operand() |
|
24
|
|
|
{ |
|
25
|
|
|
$this->sub('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\Subtraction'); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function it_creates_mul_operand() |
|
29
|
|
|
{ |
|
30
|
|
|
$this->mul('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\Multiplication'); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function it_creates_div_operand() |
|
34
|
|
|
{ |
|
35
|
|
|
$this->div('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\Division'); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function it_creates_mod_operand() |
|
39
|
|
|
{ |
|
40
|
|
|
$this->mod('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\Modulo'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function it_create_bit_and_operand() |
|
44
|
|
|
{ |
|
45
|
|
|
$this->bAnd('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\BitAnd'); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function it_create_bit_or_operand() |
|
49
|
|
|
{ |
|
50
|
|
|
$this->bOr('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\BitOr'); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function it_create_bit_xor_operand() |
|
54
|
|
|
{ |
|
55
|
|
|
$this->bXor('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\BitXor'); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function it_create_bit_left_shift_operand() |
|
59
|
|
|
{ |
|
60
|
|
|
$this->bLs('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\BitLeftShift'); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function it_create_bit_right_shift_operand() |
|
64
|
|
|
{ |
|
65
|
|
|
$this->bRs('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\BitRightShift'); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function it_create_bit_not_operand() |
|
69
|
|
|
{ |
|
70
|
|
|
$this->bNot('foo')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\BitNot'); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function it_creates_an_function() |
|
74
|
|
|
{ |
|
75
|
|
|
$this->fun('UPPER', 'foo')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\PlatformFunction'); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function it_creates_an_magic_function() |
|
79
|
|
|
{ |
|
80
|
|
|
$this->__callStatic('UPPER', ['foo'])->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\PlatformFunction'); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function it_creates_select_query_modifier() |
|
84
|
|
|
{ |
|
85
|
|
|
$this->select('foo')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Query\Select'); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function it_creates_add_select_query_modifier() |
|
89
|
|
|
{ |
|
90
|
|
|
$this->addSelect('foo')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Query\AddSelect'); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function it_creates_select_entity_selection() |
|
94
|
|
|
{ |
|
95
|
|
|
$this->selectEntity('u')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Query\Selection\SelectEntity'); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function it_creates_select_as_selection() |
|
99
|
|
|
{ |
|
100
|
|
|
$this->selectAs('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Query\Selection\SelectAs'); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function it_creates_select_hidden_as_selection() |
|
104
|
|
|
{ |
|
105
|
|
|
$this->selectHiddenAs('foo', 'bar')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Query\Selection\SelectHiddenAs'); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function it_creates_alias_operand() |
|
109
|
|
|
{ |
|
110
|
|
|
$this->alias('foo')->shouldReturnAnInstanceOf('Happyr\DoctrineSpecification\Operand\Alias'); |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
|