Skip to content
Snippets Groups Projects

added test and fix

7 unresolved threads

Closes #3334045

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
148 148 * @covers ::addClass
149 149 */
150 150 public function testAddClasses() {
151 // Attempt to add a class without initializing the 'class' attribute.
152 $attribute2 = new Attribute();
  • 148 148 * @covers ::addClass
    149 149 */
    150 150 public function testAddClasses() {
    151 // Attempt to add a class without initializing the 'class' attribute.
    152 $attribute2 = new Attribute();
    153 $attribute2['class'][] = 'test-class';
    154 $this->assertEquals(new AttributeArray('class', ['test-class']), $attribute2['class']);
    155
    151 156 // Add empty Attribute object with no classes.
    152 157 $attribute = new Attribute();
    153 158
    154 159 // Add no class on empty attribute.
    155 160 $attribute->addClass();
    156 $this->assertEmpty($attribute['class']);
    • I'm confused why this assertion is being removed.

    • Because the fix we are adding in this issue, will add the class attribute by default.So, this assertion will fail.

      I have reverted back this line with a small change, as $attribute['class']->value() will be empty now.

      Edited by Yash Rode
    • It looks like the existing test is being broken or damaged.

      You should restart with another new Attribute() after the new test code.

    • Even if we create a new attribute, because of the new code we are adding in this issue i.e: if ($name === 'class') { // Initialize the class attribute as an empty array if not set. $this->offsetSet('class', []); return $this->storage['class']; }

      this assertion needs to be changed.

    • Please register or sign in to reply
  • Yash Rode added 1 commit

    added 1 commit

    Compare with previous version

  • Yash Rode added 1 commit
  • Yash Rode added 1 commit

    added 1 commit

    • 61c9bd80 - reverted back the removed line, with a twist

    Compare with previous version

  • Yash Rode added 1 commit

    added 1 commit

    Compare with previous version

  • Joachim Noreiko added 76 commits

    added 76 commits

    Compare with previous version

  • 148 148 * @covers ::addClass
    149 149 */
    150 150 public function testAddClasses(): void {
    151 // Add empty Attribute object with no classes.
    151 // Attempt to add a class without initializing the 'class' attribute.
    152 152 $attribute = new Attribute();
    153 $attribute['class'][] = 'test-class';
    154 $this->assertEquals(new AttributeArray('class', ['test-class']), $attribute['class']);
    153 155
    156 $attribute2 = new Attribute();
  • 148 148 * @covers ::addClass
    149 149 */
    150 150 public function testAddClasses(): void {
    151 // Add empty Attribute object with no classes.
    151 // Attempt to add a class without initializing the 'class' attribute.
    152 152 $attribute = new Attribute();
    153 $attribute['class'][] = 'test-class';
  • 148 148 * @covers ::addClass
    149 149 */
    150 150 public function testAddClasses(): void {
    151 // Add empty Attribute object with no classes.
    151 // Attempt to add a class without initializing the 'class' attribute.
    152 152 $attribute = new Attribute();
    153 $attribute['class'][] = 'test-class';
    154 $this->assertEquals(new AttributeArray('class', ['test-class']), $attribute['class']);
  • 148 148 * @covers ::addClass
    149 149 */
    150 150 public function testAddClasses(): void {
    151 // Add empty Attribute object with no classes.
    151 // Attempt to add a class without initializing the 'class' attribute.
  • 94 94 if (isset($this->storage[$name])) {
    95 95 return $this->storage[$name];
    96 96 }
    97 if ($name === 'class') {
  • added 1 commit

    • 5cdc07e1 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Joachim Noreiko added 216 commits

    added 216 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • closed

  • Please register or sign in to reply
    Loading