Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
215 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Guides\Nodes; | ||
|
||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link https://phpdoc.org | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
final class ListNodeTest extends TestCase | ||
{ | ||
public function test_it_can_be_return_information_on_each_line_in_a_list() : void | ||
{ | ||
$list = [ | ||
[ | ||
'text' => 'the line text for line 1', | ||
'depth' => 0, | ||
'prefix' => '*', | ||
'ordered' => false, | ||
], | ||
]; | ||
|
||
$node = new ListNode(); | ||
$node->addLine($list[0]); | ||
|
||
self::assertSame($list, $node->getLines()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Guides\Nodes; | ||
|
||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link https://phpdoc.org | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
final class MainNodeTest extends TestCase | ||
{ | ||
public function test_it_can_be_created_with_a_value() : void | ||
{ | ||
$node = new MainNode('id'); | ||
|
||
self::assertSame('id', $node->getValue()); | ||
self::assertSame('id', $node->getValueString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Guides\Nodes; | ||
|
||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link https://phpdoc.org | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
final class MetaNodeTest extends TestCase | ||
{ | ||
public function test_it_can_be_created_with_a_key_and_value() : void | ||
{ | ||
$node = new MetaNode('key', 'value'); | ||
|
||
self::assertSame('key', $node->getKey()); | ||
self::assertSame('value', $node->getValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Guides\Nodes; | ||
|
||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link https://phpdoc.org | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
final class ParagraphNodeTest extends TestCase | ||
{ | ||
public function test_it_can_be_created_with_a_value_even_another_node() : void | ||
{ | ||
$imageNode = new ImageNode(); | ||
|
||
$node = new ParagraphNode($imageNode); | ||
|
||
self::assertSame($imageNode, $node->getValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Guides\Nodes; | ||
|
||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link https://phpdoc.org | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
final class QuoteNodeTest extends TestCase | ||
{ | ||
public function test_it_can_be_created_with_a_value_even_another_node() : void | ||
{ | ||
$imageNode = new ImageNode(); | ||
|
||
$node = new QuoteNode($imageNode); | ||
|
||
self::assertSame($imageNode, $node->getValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Guides\Nodes; | ||
|
||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link https://phpdoc.org | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
final class RawNodeTest extends TestCase | ||
{ | ||
public function test_it_can_be_created_with_a_value() : void | ||
{ | ||
$node = new RawNode('raw string'); | ||
|
||
self::assertSame('raw string', $node->getValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Guides\Nodes; | ||
|
||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link https://phpdoc.org | ||
*/ | ||
|
||
use Mockery as m; | ||
use Mockery\Adapter\Phpunit\MockeryTestCase; | ||
use phpDocumentor\Guides\Environment; | ||
|
||
final class TitleNodeTest extends MockeryTestCase | ||
{ | ||
public function test_it_can_be_created_with_a_title_slug_and_depth() : void | ||
{ | ||
$environment = m::mock(Environment::class); | ||
$environment->shouldReceive('getTitleLetters')->andReturn(['a']); | ||
$environment->shouldReceive('resetAnonymousStack'); | ||
|
||
$titleNode = new SpanNode($environment, 'Raw String'); | ||
$node = new TitleNode($titleNode, 1); | ||
$node->setTarget('target'); | ||
|
||
self::assertSame('raw-string', $node->getId()); | ||
self::assertSame($titleNode, $node->getValue()); | ||
self::assertSame(1, $node->getLevel()); | ||
self::assertSame('target', $node->getTarget()); | ||
} | ||
} |