@@ 331-347 (lines=17) @@ | ||
328 | /** |
|
329 | * Test attach_stored_licenses_on_connection() for the master user. |
|
330 | */ |
|
331 | public function test_attach_stored_licenses_on_connection__master_user() { |
|
332 | $connection = $this->createMock( Connection_Manager::class ); |
|
333 | ||
334 | $connection->method( 'is_connection_owner' )->willReturn( true ); |
|
335 | ||
336 | $licensing = $this->createPartialMock( |
|
337 | Licensing::class, |
|
338 | array( 'connection', 'attach_stored_licenses' ) |
|
339 | ); |
|
340 | ||
341 | $licensing->method( 'connection' )->willReturn( $connection ); |
|
342 | ||
343 | $licensing->expects( $this->once() ) |
|
344 | ->method( 'attach_stored_licenses' ); |
|
345 | ||
346 | $licensing->attach_stored_licenses_on_connection(); |
|
347 | } |
|
348 | ||
349 | /** |
|
350 | * Test attach_stored_licenses_on_connection() for a secondary user. |
|
@@ 352-368 (lines=17) @@ | ||
349 | /** |
|
350 | * Test attach_stored_licenses_on_connection() for a secondary user. |
|
351 | */ |
|
352 | public function test_attach_stored_licenses_on_connection__secondary_user() { |
|
353 | $connection = $this->createMock( Connection_Manager::class ); |
|
354 | ||
355 | $connection->method( 'is_connection_owner' )->willReturn( false ); |
|
356 | ||
357 | $licensing = $this->createPartialMock( |
|
358 | Licensing::class, |
|
359 | array( 'connection', 'attach_stored_licenses' ) |
|
360 | ); |
|
361 | ||
362 | $licensing->method( 'connection' )->willReturn( $connection ); |
|
363 | ||
364 | $licensing->expects( $this->never() ) |
|
365 | ->method( 'attach_stored_licenses' ); |
|
366 | ||
367 | $licensing->attach_stored_licenses_on_connection(); |
|
368 | } |
|
369 | } |
|
370 |