1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Maestriam\Samurai\Tests\Unit\Foundation\SyntaxValidator; |
4
|
|
|
|
5
|
|
|
use Maestriam\Samurai\Tests\TestCase; |
6
|
|
|
use Maestriam\Samurai\Foundation\SyntaxValidator; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Testes de funcionalidades básicas apresentadas no README.md |
10
|
|
|
*/ |
11
|
|
|
class SyntaxValidatorTestCase extends TestCase |
12
|
|
|
{ |
13
|
|
|
public function testInitTheme() |
14
|
|
|
{ |
15
|
|
|
$validator = new SyntaxValidator(); |
16
|
|
|
|
17
|
|
|
$this->assertObjectHasFunction($validator, 'author'); |
18
|
|
|
$this->assertObjectHasFunction($validator, 'vendor'); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Contesta um teste para verificar se há retorno de sucesso |
23
|
|
|
* |
24
|
|
|
* @param mixed $vendor |
25
|
|
|
* @return void |
26
|
|
|
*/ |
27
|
|
|
protected function assertValidVendor($vendor) |
28
|
|
|
{ |
29
|
|
|
$validator = new SyntaxValidator(); |
30
|
|
|
|
31
|
|
|
$result = $validator->vendor($vendor); |
32
|
|
|
|
33
|
|
|
$this->assertIsBool($result); |
34
|
|
|
$this->assertTrue($result); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Contesta um teste para verificar se há retorno de falha |
39
|
|
|
* |
40
|
|
|
* @param mixed $vendor |
41
|
|
|
* @return void |
42
|
|
|
*/ |
43
|
|
|
protected function assertInvalidVendor($vendor) |
44
|
|
|
{ |
45
|
|
|
$validator = new SyntaxValidator(); |
46
|
|
|
|
47
|
|
|
$result = $validator->vendor($vendor); |
48
|
|
|
|
49
|
|
|
$this->assertIsBool($result); |
50
|
|
|
$this->assertFalse($result); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Contesta um teste para verificar se há retorno de sucesso |
55
|
|
|
* |
56
|
|
|
* @param mixed $vendor |
57
|
|
|
* @return void |
58
|
|
|
*/ |
59
|
|
|
protected function assertValidAuthor($vendor) |
60
|
|
|
{ |
61
|
|
|
$validator = new SyntaxValidator(); |
62
|
|
|
|
63
|
|
|
$result = $validator->author($vendor); |
64
|
|
|
|
65
|
|
|
$this->assertIsBool($result); |
66
|
|
|
$this->assertTrue($result); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Contesta um teste para verificar se há retorno de falha |
71
|
|
|
* |
72
|
|
|
* @param mixed $vendor |
73
|
|
|
* @return void |
74
|
|
|
*/ |
75
|
|
|
protected function assertInvalidAuthor($vendor) |
76
|
|
|
{ |
77
|
|
|
$validator = new SyntaxValidator(); |
78
|
|
|
|
79
|
|
|
$result = $validator->author($vendor); |
80
|
|
|
|
81
|
|
|
$this->assertIsBool($result); |
82
|
|
|
$this->assertFalse($result); |
83
|
|
|
} |
84
|
|
|
} |