ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 10 of file EntriesYamlParserTest.php.

Member Function Documentation

◆ setUp()

CrawlerTest::setUp ( )
protected

Definition at line 24 of file EntriesYamlParserTest.php.

24 : void
25 {
26 $this->parser = new Crawler\EntriesYamlParser();
27 $this->proper_entry = new ProperEntryFixture();
28 }

◆ testCamelCase()

CrawlerTest::testCamelCase ( )

Definition at line 98 of file EntriesYamlParserTest.php.

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

◆ testGenerateEntry()

CrawlerTest::testGenerateEntry ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 109 of file EntriesYamlParserTest.php.

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

◆ testInvalidYamlEntry()

CrawlerTest::testInvalidYamlEntry ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 88 of file EntriesYamlParserTest.php.

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

References Vendor\Package\$e.

◆ testNoDescriptionEntry()

CrawlerTest::testNoDescriptionEntry ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 63 of file EntriesYamlParserTest.php.

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

References Vendor\Package\$e.

◆ testNoReturnValueEntry()

CrawlerTest::testNoReturnValueEntry ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 75 of file EntriesYamlParserTest.php.

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

References Vendor\Package\$e.

◆ testParseInvalidFile()

CrawlerTest::testParseInvalidFile ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 33 of file EntriesYamlParserTest.php.

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

References Vendor\Package\$e.

◆ testParseProperEntryToArray()

CrawlerTest::testParseProperEntryToArray ( )

Definition at line 54 of file EntriesYamlParserTest.php.

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

◆ testParseProperEntryToYamlEntries()

CrawlerTest::testParseProperEntryToYamlEntries ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 46 of file EntriesYamlParserTest.php.

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

Field Documentation

◆ $parser

CrawlerTest::$parser
protected

Definition at line 17 of file EntriesYamlParserTest.php.

◆ $proper_entry

CrawlerTest::$proper_entry
protected

Definition at line 22 of file EntriesYamlParserTest.php.


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