ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
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 23 of file EntriesYamlParserTest.php.

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

◆ testCamelCase()

CrawlerTest::testCamelCase ( )

Definition at line 95 of file EntriesYamlParserTest.php.

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

◆ testGenerateEntry()

CrawlerTest::testGenerateEntry ( )
Exceptions
Crawler

Definition at line 106 of file EntriesYamlParserTest.php.

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

◆ testInvalidYamlEntry()

CrawlerTest::testInvalidYamlEntry ( )
Exceptions
Crawler

Definition at line 85 of file EntriesYamlParserTest.php.

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

◆ testNoDescriptionEntry()

CrawlerTest::testNoDescriptionEntry ( )
Exceptions
Crawler

Definition at line 60 of file EntriesYamlParserTest.php.

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

◆ testNoReturnValueEntry()

CrawlerTest::testNoReturnValueEntry ( )
Exceptions
Crawler

Definition at line 72 of file EntriesYamlParserTest.php.

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

◆ testParseInvalidFile()

CrawlerTest::testParseInvalidFile ( )
Exceptions
Crawler

Definition at line 32 of file EntriesYamlParserTest.php.

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

◆ testParseProperEntryToArray()

CrawlerTest::testParseProperEntryToArray ( )

Definition at line 52 of file EntriesYamlParserTest.php.

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

◆ testParseProperEntryToYamlEntries()

CrawlerTest::testParseProperEntryToYamlEntries ( )
Exceptions
Crawler

Definition at line 45 of file EntriesYamlParserTest.php.

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

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: