Skip to content

Commit 9e68b98

Browse files
committed
Add all tests for --kinds parameter
1 parent e9e44d3 commit 9e68b98

File tree

4 files changed

+261
-164
lines changed

4 files changed

+261
-164
lines changed

bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
--fields=[+|-]flags
6161
Include selected extension fields (flags: "afmikKlnsStz") [fks].
6262
--kinds=[+|-]flags
63-
Enable/disable tag kinds [cmfpvdi]
63+
Enable/disable tag kinds [cmfpvditn]
6464
--format=level
6565
Force output of specified tag file format [2].
6666
--help
@@ -152,7 +152,7 @@
152152
}
153153

154154
if (!isset($options['kinds'])) {
155-
$options['kinds'] = array('c', 'm', 'f', 'p', 'd', 'v', 'i');
155+
$options['kinds'] = array('c', 'm', 'f', 'p', 'd', 'v', 'i', 't', 'n');
156156
} else {
157157
$options['kinds'] = str_split($options['kinds']);
158158
}

tests/Acceptance/AcceptanceTestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ protected function runPHPCtags(array $params = array())
7373

7474
protected function runPHPCtagsWithKinds($kindString)
7575
{
76+
$this->runPHPCtags(array("--kinds=$kindString"));
7677
}
7778

7879
/**

tests/Acceptance/ClassesTest.php

Lines changed: 0 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -213,166 +213,4 @@ class MyClass {
213213
3
214214
);
215215
}
216-
217-
/**
218-
* @test
219-
*/
220-
public function itSupportsClassKindParameter()
221-
{
222-
$this->givenSourceFile('ClassKindsExample.php', <<<'EOS'
223-
<?php
224-
225-
class ClassKindsExample
226-
{
227-
public $publicProperty;
228-
protected $protectedProperty;
229-
private $privateProperty;
230-
231-
public function publicMethod()
232-
{
233-
}
234-
235-
protected function protectedMethod()
236-
{
237-
}
238-
239-
private function privateMethod()
240-
{
241-
}
242-
}
243-
EOS
244-
);
245-
246-
$this->runPHPCtagsWithKinds('c');
247-
248-
$this->assertTagsFileHeaderIsCorrect();
249-
$this->assertNumberOfTagsInTagsFileIs(1);
250-
251-
$this->assertTagsFileContainsTag(
252-
'ClassKindsExample.php',
253-
'ClassKindsExample',
254-
self::KIND_CLASS,
255-
3
256-
);
257-
}
258-
259-
/**
260-
* @test
261-
*/
262-
public function itSupportsPropertyKindParameter()
263-
{
264-
$this->givenSourceFile('PropertyKindsExample.php', <<<'EOS'
265-
<?php
266-
267-
class PropertyKindsExample
268-
{
269-
public $publicProperty;
270-
protected $protectedProperty;
271-
private $privateProperty;
272-
273-
public function publicMethod()
274-
{
275-
}
276-
277-
protected function protectedMethod()
278-
{
279-
}
280-
281-
private function privateMethod()
282-
{
283-
}
284-
}
285-
EOS
286-
);
287-
288-
$this->runPHPCtagsWithKinds('p');
289-
290-
$this->assertTagsFileHeaderIsCorrect();
291-
$this->assertNumberOfTagsInTagsFileIs(3);
292-
293-
$this->assertTagsFileContainsTag(
294-
'PropertyKindsExample.php',
295-
'publicProperty',
296-
self::KIND_PROPERTY,
297-
5,
298-
'class:TestClass',
299-
'public'
300-
);
301-
$this->assertTagsFileContainsTag(
302-
'PropertyKindsExample.php',
303-
'protectedProperty',
304-
self::KIND_PROPERTY,
305-
6,
306-
'class:TestClass',
307-
'protected'
308-
);
309-
$this->assertTagsFileContainsTag(
310-
'PropertyKindsExample.php',
311-
'privateProperty',
312-
self::KIND_PROPERTY,
313-
7,
314-
'class:TestClass',
315-
'private'
316-
);
317-
}
318-
319-
/**
320-
* @test
321-
*/
322-
public function itSupportsMethodKindParameter()
323-
{
324-
$this->givenSourceFile('MethodKindsExample.php', <<<'EOS'
325-
<?php
326-
327-
class MethodKindsExample
328-
{
329-
public $publicProperty;
330-
protected $protectedProperty;
331-
private $privateProperty;
332-
333-
public function publicMethod()
334-
{
335-
}
336-
337-
protected function protectedMethod()
338-
{
339-
}
340-
341-
private function privateMethod()
342-
{
343-
}
344-
}
345-
EOS
346-
);
347-
348-
$this->runPHPCtagsWithKinds('m');
349-
350-
$this->assertTagsFileHeaderIsCorrect();
351-
$this->assertNumberOfTagsInTagsFileIs(3);
352-
353-
$this->assertTagsFileContainsTag(
354-
'MethodKindsExample.php',
355-
'publicMethod',
356-
self::KIND_METHOD,
357-
9,
358-
'class:TestClass',
359-
'public'
360-
);
361-
$this->assertTagsFileContainsTag(
362-
'MethodKindsExample.php',
363-
'protectedMethod',
364-
self::KIND_METHOD,
365-
13,
366-
'class:TestClass',
367-
'protected'
368-
);
369-
$this->assertTagsFileContainsTag(
370-
'MethodKindsExample.php',
371-
'privateMethod',
372-
self::KIND_METHOD,
373-
17,
374-
'class:TestClass',
375-
'private'
376-
);
377-
}
378216
}

0 commit comments

Comments
 (0)