diff --git a/.github/actions/setup-node-npm/action.yml b/.github/actions/setup-node-npm/action.yml index 8f364bb8bc3..ef80aa8a5d0 100644 --- a/.github/actions/setup-node-npm/action.yml +++ b/.github/actions/setup-node-npm/action.yml @@ -6,7 +6,7 @@ runs: using: 'composite' steps: - name: Configure Node.js cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v3.3.2 id: node-npm-cache env: SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5' @@ -14,6 +14,13 @@ runs: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }}-${{ hashFiles('.github/actions/setup-node-npm/action.yml') }} + # Since it gets downloaded with npm install, we need to cache it instantly. + - name: Setup puppeteer cache + uses: actions/cache@v3.3.2 + with: + path: ~/.cache/puppeteer + key: ${{ runner.os }}-puppeteer + - name: Setup Node.js uses: actions/setup-node@v4 with: diff --git a/.github/workflows/build-test-measure.yml b/.github/workflows/build-test-measure.yml index 252014cb9ee..08a150ed9dd 100644 --- a/.github/workflows/build-test-measure.yml +++ b/.github/workflows/build-test-measure.yml @@ -223,12 +223,6 @@ jobs: path: ~/.jest-cache key: ${{ runner.os }}-jest-e2e-${{ matrix.part }} - - name: Setup puppeteer cache - uses: actions/cache@v3.3.2 - with: - path: ~/.cache/puppeteer - key: ${{ runner.os }}-puppeteer - - name: Start Docker environment run: npm run env:start:ci env: diff --git a/tests/e2e/utils/amp-settings-utils.js b/tests/e2e/utils/amp-settings-utils.js index 382c43d166c..c1ef7e13c7e 100644 --- a/tests/e2e/utils/amp-settings-utils.js +++ b/tests/e2e/utils/amp-settings-utils.js @@ -131,7 +131,7 @@ export async function cleanUpValidatedUrls() { await page.click('#doaction'); await page.waitForXPath( - '//*[contains(@class, "updated notice")]/p[contains(text(), "forgotten")]' + '//*[contains(@class, "notice") and contains(@class, "updated")]/p[contains(text(), "forgotten")]' ); await switchUserToTest(); } diff --git a/tests/php/src/Helpers/PrivateAccess.php b/tests/php/src/Helpers/PrivateAccess.php index 4e2ed604fd7..9c26466754f 100644 --- a/tests/php/src/Helpers/PrivateAccess.php +++ b/tests/php/src/Helpers/PrivateAccess.php @@ -59,12 +59,15 @@ private function call_private_static_method( $class, $method_name, $args = [] ) * @throws ReflectionException If the object could not be reflected upon. */ private function set_private_property( $object, $property_name, $value ) { - $property = ( new ReflectionClass( $object ) )->getProperty( $property_name ); + $reflection_class = new ReflectionClass( $object ); + $property = $reflection_class->getProperty( $property_name ); $property->setAccessible( true ); - // Note: In PHP 8, `ReflectionProperty::getValue()` now requires that an object be supplied if it's a - // non-static property. - $property->isStatic() ? $property->setValue( $value ) : $property->setValue( $object, $value ); + if ( $property->isStatic() ) { + $reflection_class->setStaticPropertyValue( $property_name, $value ); + } else { + $property->setValue( $object, $value ); + } } /** diff --git a/tests/php/src/Infrastructure/SimpleInjectorTest.php b/tests/php/src/Infrastructure/SimpleInjectorTest.php index faa62a50767..02722935e75 100644 --- a/tests/php/src/Infrastructure/SimpleInjectorTest.php +++ b/tests/php/src/Infrastructure/SimpleInjectorTest.php @@ -127,7 +127,7 @@ static function ( $class ) { $object = $injector->make( Fixture\DummyInterface::class ); $this->assertInstanceOf( stdClass::class, $object ); - $this->assertObjectHasAttribute( 'class_name', $object ); + $this->assertObjectHasProperty( 'class_name', $object ); $this->assertEquals( Fixture\DummyInterface::class, $object->class_name ); } @@ -148,7 +148,7 @@ static function ( $class ) { $object = $injector->make( Fixture\DummyInterface::class ); $this->assertInstanceOf( stdClass::class, $object ); - $this->assertObjectHasAttribute( 'class_name', $object ); + $this->assertObjectHasProperty( 'class_name', $object ); $this->assertEquals( Fixture\DummyClassWithDependency::class, $object->class_name ); } diff --git a/tests/php/validation/test-class-amp-validation-manager.php b/tests/php/validation/test-class-amp-validation-manager.php index ce931a4a52a..6fb0708306d 100644 --- a/tests/php/validation/test-class-amp-validation-manager.php +++ b/tests/php/validation/test-class-amp-validation-manager.php @@ -535,7 +535,7 @@ public function test_add_admin_bar_menu_items() { wp_set_current_user( self::factory()->user->create( [ 'role' => 'administrator' ] ) ); $this->assertTrue( current_user_can( 'manage_options' ) ); AMP_Validation_Manager::add_admin_bar_menu_items( $admin_bar ); - $this->assertObjectHasAttribute( 'href', $admin_bar->get_node( 'amp-settings' ) ); + $this->assertObjectHasProperty( 'href', $admin_bar->get_node( 'amp-settings' ) ); } /** @@ -1438,6 +1438,16 @@ public function test_add_block_source_comments( $content, $expected, $query ) { // Remove class name injected by gutenberg_render_layout_support_flag(). $rendered_block = preg_replace( '/\s*(?<= class=")?wp-container-\w+\s*/', '', $rendered_block ); + // Remove unique layout ID. + $rendered_block = preg_replace( '/\s*(?<= class=")?has-\d+-columns-columns-layout-\d+\s*/', ' has-2-columns', $rendered_block ); + + // Remove layout class name and ID. + $rendered_block = str_replace( + ' is-layout-flow wp-block-quote-is-layout-flow', + '', + $rendered_block + ); + $expected = str_replace( [ '{{post_id}}',