<?php

namespace AmpProject;

use AmpProject\Tests\TestCase;

/**
 * Tests for AmpProject\CssLength.
 *
 * @todo   This is only a stub and basic smoke test, more tests need to be added here, as the plugin didn't have any.
 *
 * @covers \AmpProject\CssLength
 * @package ampproject/amp-toolbox
 */
class CssLengthTest extends TestCase
{

    public function dataCssLength()
    {
        return [
            'empty'            => [null, false, false, true, false, false, false],
            'allowed auto'     => ['auto', true, false, true, true, true, false],
            'disallowed auto'  => ['auto', false, false, false, true, true, false],
            'allowed fluid'    => ['fluid', false, true, true, true, false, true],
            'disallowed fluid' => ['fluid', false, false, false, true, false, true],
            '10px'             => ['10px', false, false, true, true, false, false],
        ];
    }

    /**
     * Test CssLength.
     *
     * @dataProvider dataCssLength()
     */
    public function testCssLength($value, $allowAuto, $allowFluid, $valid, $defined, $auto, $fluid)
    {
        $length = new CssLength($value);
        $length->validate($allowAuto, $allowFluid);

        $this->assertEquals($valid, $length->isValid());
        $this->assertEquals($defined, $length->isDefined());
        $this->assertEquals($fluid, $length->isFluid());
        $this->assertEquals($auto, $length->isAuto());
    }
}

<?php

namespace AmpProject;

use AmpProject\Tests\TestCase;

/**
 * Tests for AmpProject\CssLength.
 *
 * @todo   This is only a stub and basic smoke test, more tests need to be added here, as the plugin didn't have any.
 *
 * @covers \AmpProject\CssLength
 * @package ampproject/amp-toolbox
 */
class CssLengthTest extends TestCase
{

    /**
     * Test instantiating empty CssLength.
     *
     * @covers \AmpProject\CssLength::__construct()
     * @covers \AmpProject\CssLength::isValid()
     * @covers \AmpProject\CssLength::isDefined()
     */
    public function testEmptyCssLengthIsValidButNotDefined()
    {
        $length = new CssLength(null);
        $this->assertTrue($length->isValid());
        $this->assertFalse($length->isDefined());
    }
}

--- 
+++ 
@@ -15,17 +15,31 @@
 class CssLengthTest extends TestCase
 {
 
+    public function dataCssLength()
+    {
+        return [
+            'empty'            => [null, false, false, true, false, false, false],
+            'allowed auto'     => ['auto', true, false, true, true, true, false],
+            'disallowed auto'  => ['auto', false, false, false, true, true, false],
+            'allowed fluid'    => ['fluid', false, true, true, true, false, true],
+            'disallowed fluid' => ['fluid', false, false, false, true, false, true],
+            '10px'             => ['10px', false, false, true, true, false, false],
+        ];
+    }
+
     /**
-     * Test instantiating empty CssLength.
+     * Test CssLength.
      *
-     * @covers \AmpProject\CssLength::__construct()
-     * @covers \AmpProject\CssLength::isValid()
-     * @covers \AmpProject\CssLength::isDefined()
+     * @dataProvider dataCssLength()
      */
-    public function testEmptyCssLengthIsValidButNotDefined()
+    public function testCssLength($value, $allowAuto, $allowFluid, $valid, $defined, $auto, $fluid)
     {
-        $length = new CssLength(null);
-        $this->assertTrue($length->isValid());
-        $this->assertFalse($length->isDefined());
+        $length = new CssLength($value);
+        $length->validate($allowAuto, $allowFluid);
+
+        $this->assertEquals($valid, $length->isValid());
+        $this->assertEquals($defined, $length->isDefined());
+        $this->assertEquals($fluid, $length->isFluid());
+        $this->assertEquals($auto, $length->isAuto());
     }
 }
Add missing test scenarios for CssLength.php
