assertSorted example

/** * Tests that the phpcs.xml.dist file is properly sorted. */
  public function testSorted() {
    $content = file_get_contents($this->filePath);
    $xml_encoder = new XmlEncoder();
    $xml_encoded = $xml_encoder->decode($content, 'xml');
    $this->assertIsArray($xml_encoded);

    $top_level_keys = array_keys($xml_encoded);
    $this->assertSorted($top_level_keys);

    $this->assertArrayHasKey('file', $xml_encoded);
    $files = $xml_encoded['file'];
    $this->assertSorted($files);

    $this->assertArrayHasKey('exclude-pattern', $xml_encoded);
    $excluded_patterns = $xml_encoded['exclude-pattern'];
    $this->assertSorted($excluded_patterns);

    $this->assertArrayHasKey('rule', $xml_encoded);
    $rules = $xml_encoded['rule'];
    
Home | Imprint | This part of the site doesn't use cookies.