ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
CrawlerTest Class Reference
+ Inheritance diagram for CrawlerTest:
+ Collaboration diagram for CrawlerTest:

Public Member Functions

 testParseInvalidFile ()
 
 testParseProperEntryToYamlEntries ()
 
 testParseProperEntryToArray ()
 
 testNoDescriptionEntry ()
 
 testNoReturnValueEntry ()
 
 testInvalidYamlEntry ()
 
 testCamelCase ()
 
 testGenerateEntry ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $parser
 
 $proper_entry
 

Detailed Description

Definition at line 9 of file EntriesYamlParserTest.php.

Member Function Documentation

◆ setUp()

CrawlerTest::setUp ( )
protected

Definition at line 23 of file EntriesYamlParserTest.php.

◆ testCamelCase()

CrawlerTest::testCamelCase ( )

Definition at line 97 of file EntriesYamlParserTest.php.

98 {
99 $test_string = "Hello Camel Case";
100
101 $this->assertEquals("helloCamelCase", Crawler\EntriesYamlParser::toLowerCamelCase($test_string, ' '));
102 $this->assertEquals("HelloCamelCase", Crawler\EntriesYamlParser::toUpperCamelCase($test_string, ' '));
103 }

◆ testGenerateEntry()

CrawlerTest::testGenerateEntry ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 108 of file EntriesYamlParserTest.php.

109 {
110 $entries = $this->parser->parseEntriesFromFile("tests/UI/Crawler/Fixture/ProperEntry.php");
111
112 $this->assertEquals(1, count($entries));
113 $this->assertEquals("CrawlerFixtureProperEntryProperEntry", $entries->getEntryById("CrawlerFixtureProperEntryProperEntry")->getId());
114 $this->assertEquals("src/UI/Crawler/Fixture/ProperEntry", $entries->getEntryById("CrawlerFixtureProperEntryProperEntry")->getPath());
115 }

◆ testInvalidYamlEntry()

CrawlerTest::testInvalidYamlEntry ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 87 of file EntriesYamlParserTest.php.

88 {
89 try {
90 $this->parser->parseArrayFromFile("tests/UI/Crawler/Fixture/InvalidYamlEntry.php");
91 $this->assertFalse("This should not happen");
92 } catch (Crawler\Exception\CrawlerException $e) {
93 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::PARSING_YAML_ENTRY_FAILED);
94 }
95 }

◆ testNoDescriptionEntry()

CrawlerTest::testNoDescriptionEntry ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 62 of file EntriesYamlParserTest.php.

63 {
64 try {
65 $this->parser->parseYamlStringArrayFromFile("tests/UI/Crawler/Fixture/NoDescriptionEntry.php");
66 $this->assertFalse("This should not happen");
67 } catch (Crawler\Exception\CrawlerException $e) {
68 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::ENTRY_WITH_NO_YAML_DESCRIPTION);
69 }
70 }

◆ testNoReturnValueEntry()

CrawlerTest::testNoReturnValueEntry ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 74 of file EntriesYamlParserTest.php.

75 {
76 try {
77 $this->parser->parseYamlStringArrayFromFile("tests/UI/Crawler/Fixture/NoReturnValueEntry.php");
78 $this->assertFalse("This should not happen");
79 } catch (Crawler\Exception\CrawlerException $e) {
80 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::ENTRY_WITH_NO_VALID_RETURN_STATEMENT);
81 }
82 }

◆ testParseInvalidFile()

CrawlerTest::testParseInvalidFile ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 32 of file EntriesYamlParserTest.php.

33 {
34 try {
35 $this->parser->parseYamlStringArrayFromFile("Invalid Path");
36 $this->assertFalse("This should not happen");
37 } catch (Crawler\Exception\CrawlerException $e) {
38 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::INVALID_FILE_PATH);
39 }
40 }

◆ testParseProperEntryToArray()

CrawlerTest::testParseProperEntryToArray ( )

Definition at line 53 of file EntriesYamlParserTest.php.

54 {
55 $entries = $this->parser->parseArrayFromFile("tests/UI/Crawler/Fixture/ProperEntry.php");
56 $this->assertEquals($this->proper_entry->properEntryYamlArray, $entries);
57 }

◆ testParseProperEntryToYamlEntries()

CrawlerTest::testParseProperEntryToYamlEntries ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 45 of file EntriesYamlParserTest.php.

46 {
47 $yaml_entries = $this->parser->parseYamlStringArrayFromFile("tests/UI/Crawler/Fixture/ProperEntry.php");
48
49 $this->assertEquals($this->proper_entry->properEntryYamlString, $yaml_entries[0]);
50 $this->assertEquals($this->proper_entry->properEntryYamlString, $yaml_entries[0]);
51 }

Field Documentation

◆ $parser

CrawlerTest::$parser
protected

Definition at line 16 of file EntriesYamlParserTest.php.

◆ $proper_entry

CrawlerTest::$proper_entry
protected

Definition at line 21 of file EntriesYamlParserTest.php.


The documentation for this class was generated from the following file: