127 | | // It's supposed to link to page 1: |
128 | | $this->assertTag( array( 'tag' => 'a', 'attributes' => array( 'href' => 'http://' . WP_TESTS_DOMAIN . '/' ) ), $links[0] ); |
129 | | $this->assertTag( array( 'tag' => 'a', 'attributes' => array( 'href' => 'http://' . WP_TESTS_DOMAIN . '/' ) ), $links[1] ); |
| 127 | $expected_attributes = array( |
| 128 | 0 => array( |
| 129 | 'href' => 'http://' . WP_TESTS_DOMAIN . '/', |
| 130 | 'class' => 'prev page-numbers' |
| 131 | ), |
| 132 | 1 => array( |
| 133 | 'href' => 'http://' . WP_TESTS_DOMAIN . '/', |
| 134 | 'class' => 'page-numbers' |
| 135 | ) |
| 136 | ); |
| 141 | // The first two links should link to page 1 |
| 142 | foreach ( $expected_attributes as $link_idx => $attributes ) { |
| 143 | |
| 144 | $document->loadHTML( $links[$link_idx] ); |
| 145 | $tag = $document->getElementsByTagName( 'a' )->item( 0 ); |
| 146 | |
| 147 | $this->assertNotNull( $tag ); |
| 148 | |
| 149 | $href = $tag->attributes->getNamedItem( 'href' )->value; |
| 150 | $class = $tag->attributes->getNamedItem( 'class' )->value; |
| 151 | |
| 152 | $this->assertEquals( $attributes['href'], $href ); |
| 153 | $this->assertEquals( $attributes['class'], $class ); |
| 154 | |
| 155 | } |
| 156 | |
144 | | $this->assertTag( array( 'tag' => 'span', 'attributes' => array( 'class' => 'current' ) ), $links[0] ); |
145 | | $this->assertTag( array( 'tag' => 'a', 'attributes' => array( 'href' => get_pagenum_link( 2 ) ) ), $links[1] ); |
| 166 | $document->loadHTML( $links[0] ); |
| 167 | $tag = $document->getElementsByTagName( 'span' )->item( 0 ); |
| 168 | |
| 169 | $this->assertNotNull( $tag ); |
| 170 | |
| 171 | $class = $tag->attributes->getNamedItem( 'class' )->value; |
| 172 | |
| 173 | $this->assertEquals( 'page-numbers current', $class ); |
| 174 | |
| 175 | $document->loadHTML( $links[1] ); |
| 176 | $tag = $document->getElementsByTagName( 'a' )->item( 0 ); |
| 177 | |
| 178 | $this->assertNotNull( $tag ); |
| 179 | |
| 180 | $href = $tag->attributes->getNamedItem( 'href' )->value; |
| 181 | |
| 182 | $this->assertEquals( get_pagenum_link( 2 ), $href ); |
| 183 | |